HI, i am developing a program where i have to auto save the excel file. i try putting some integer data's in excel and auto save the file it works perfect. while i try to auto save the file with some string value in it. it shows me error.
AutoWrap()-IDispatch::GetIDsOfNames("Saved")failed w/err 0x80020006 - this is the error what i am getting right now. please help me to auto save the excel file while it have string value in it.
Each time when you get such type of error code, you can try getting its description by using Error Lookup tool which is shipped with Visual Studio.
E.g. 0x80020006 means "Unknown name".
First of all you have to properly format your code using Code tags. Otherwise your code is absolutely unreadable!
Second, the error you got is DISP_E_UNKNOWNNAME. According to MSDN article IDispatch::GetIDsOfNames method:
DISP_E_UNKNOWNNAME
One or more of the specified names were not known. The returned array of DISPIDs contains DISPID_UNKNOWN for each entry that corresponds to an unknown name.
So what you now have to do is debug your code step-by-step to see what parameters you pass in the GetIDsOfNames trying to "save" the excel sheet.
Besides, What a strange design to #undefine UNICODE (and _UNICODE) but use everywhere functions that require UNICODE parameters? And why do you need then convert UNICODE to MBCS instead of just use MessageBoxW API?
And BTW, your buffer length for:
szName is only 200 while you pass the ptName array of the size 256
bufis only 200 while it must be at least the length of szName i plus the length of the formatted text
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
this code work fine but the issue is i am updating the excel file regularly and each time the excel file asking me saveas. i want the excel file is autosaved while i am closing the excel file. plz help
Actually i am new to this and i have taken code from net. yes i debug the code but i am not clear where the error is .. as u said the szname, buf size is less(200) compare to the given size(256). i try changing the size of the szName and buf still the error coming. i try to find out what is there in the ptName. could you plz help me.
Set a break point in the begin of the AutoWrap function, press F5 to start debugging and goto the break point.
Then use F10 to execute code step-by-step and look at the debugger windows (Autos or Watch) to see the current values of the variables...
Do this just before you do the SaveAs and then right afterwards you might want to set DisplayAlerts back to TRUE
just after the SaveAs Operation.
If that doesn't fully work, you will need to set the Saved property of the pXLBook to TRUE before saving.
I haven't tried it but I think it would be of the form:
Last edited by Tom Frohman; September 20th, 2012 at 07:17 AM.
Verere testudinem! (Fear the turtle)
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
Bookmarks