Accessing Excel through Access using VBA

usiddiqi

New member
Local time
Today, 14:23
Joined
Jul 14, 2005
Messages
6
Hi All,

Im accessing an excel sheet throug Access using VBA...actually i have to format that excel sheet in and write it into a table...so i can not directly import the excel sheet.

Following is the code that im using
--------------------------

For Each ws In obWBK.Worksheets
rowCount = ws.UsedRange.Rows.Count
stSQL = "SELECT * From [" & ws.name & "$A1:IV" & rowCount & "]"
rs.Open stSQL, stCon, adOpenForwardOnly, adLockReadOnly, adCmdText
rs.moveFirst
Do Until rs.EOF
For FldCount = 0 To rs.Fields.Count - 1
debug.print rs.fields(FldCount) ----- problem line , line 1
next FldCount
loop
next ws
---------------------------------------------------------

Well this code runs fine for me, only sometimes in "line 1" it returns null, though there is data on that cell.
Is there any other method of getting the data?

Regards,
Umer Siddiqi
 

Users who are viewing this thread

Back
Top Bottom