Click here to Skip to main content
15,922,007 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
i am working with VB6 code which writes data to excelsheet.cells from a RecordSet.
actually a lot of data is being written .when the data is less no problem occurs but when more than 800 columns and 12 rows are to be written then i get error 1004 "Application defined or object defined error".
i searched a lot for this error and finally introduced a delay just before writing to cells the data read from recordset(this data is just a number)
Although everything works fine with a 0.01 s delay BUT
the delay is hardcoded and i want to avoid it as it increases the time.

IS there any API or any way,any method by which i can wait for the excelsheet.cells to initialise and then go ahead with filling in the data.

may be something like "bool cellinitialized(excelsheet.cell(x,y))"
Any help will be highly appreciated.Thanks in advance.

code goes like this :
VB
If Not IsNull(RecordSet(z).value) Then
Delay (10)'  this delay is simple function to get time delay
          ' i want to do away with this delay
          'and use some api or method instead which can signal to go ahead only 
        'when the excelsheet Cell has been initialized

excelSheet.cells(x,y)=RecordSet(z)

'x,y,z are variables for the loop
Posted

1 solution

hi guys,
i think i got it . all i needed was Application.DoEvents().
its working for now but will have to keep looking.
anyone interseted can look here
http://www.mrexcel.com/forum/showthread.php?t=19342[^]

thanks for looking at this question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900