Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE IDispatch exception code 0 from ?:?..

Status
Not open for further replies.

LotusE

Programmer
Nov 22, 2002
25
BE
OLE IDispatch exception code 0 from ?:?..

I'm getting this error message when I want to export data from an array to an Excel sheet. BUT I only get this error when column 2 has a date value AND column 3 of my table also has a date value. I use this procedure for more than 10 tables/arrays and all runs well, except in this case. This is the (simple) code (thisform.laexport is the array):

For lni=1 To lnrow

For lnii=1 To lncol
If Vartype(Thisform.laexport (lni,lnii))=="C"
loexcel.Cells (lni+1,lnii).Value= AlltriM(Thisform.laexport (lni,lnii))
Else
* this is where foxpro hangs on the second date loexcel.Cells (lni+1,lnii).Value= Thisform.laexport (lni,lnii)

Endif
Endfor
Endfor

Does anyone know why I get this error message only in this particular case? (2 columns following each other and both containing a date value) I've already tried the datatoclip() method in combination with a cursor instead of an array but the problem is that memo fields are exported as "Memo" and do not display their true value. So I cannot use it. But I didn't receive the error if this info is any help.

Thanks in advance!

Cheers

LotusE
 
Perhaps some more useful info: I don't get the error when I run my software in the foxpro development area. But when I run it outside foxpro, it get the error.

Cheers

LotusE
 

Have you check that you might trying to send a numeric value to a character cell in Excel?



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I don't think that's it, because it all goes well for the first date, it's only the second date that causes the error. And I don't do anything specific for the first date either. If you look at the procedure, it's pretty straightforward: just put everything from the array in excel. The only thing I do is taking away the spaces in character fields.

Cheers

LotusE
 

I would still use a TRANSFORM() on your date variable, I have encountered this issue before. It doesn't hurt to try it.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
that's it, it works fine now, thanks alot!

Cheers

lotusE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top