|
-
Aug 3rd, 2005, 04:23 AM
#1
Thread Starter
New Member
[RESOLVED] VB6 and reading from Excel
g'day,
any chance anyone's come across this problem before....
one moment my subroutine reads fine from my Excel file, the next it returns a null value as if the cell was empty.
eg in the following section of code, variables temp1, temp2 and temp3 are all defined the same (singles), and all cells in excel are formatted the same ie number format, 2 digits.
the first few runs, all variables were assigned the correct values (ie VB6 read the correct data from the excel file). then later, temp2 and temp3 were read as null or empty, and (obviously) my calcs don't work anymore!
the variable types for temp2 and 3 have also changed to 'AdVarWchar = 202'
ElseIf j = 5 Then
temp1(i, c, id) = inputTable.Fields(j).Value
ElseIf j = 6 Then
temp2(i, c, id) = inputTable.Fields(j).Value
ElseIf j = 7 Then
temp3(i, c, id) = inputTable.Fields(j).Value
ElseIf j = 8 Then
etc etc
If anyone has any suggestions, they'd be much appreciated...
I'm currently using an ADODB connection ("Provider=Microsoft.Jet.OLEDB.4.0;") to link to the excel workbook, but maybe there's a better way?
cheers!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|