Workbook::SaveAs() in MFC - Please help!

G

Guest

Hi,
I can't find any information on how to use automation to save a file in
MFC. I have the file name I need to save to. I have automation working and
have my workbook created. Now all I need is the correct way to call the
Workbook::SaveAs method.

This is what I'm trying right now:
book.SaveAs(COleVariant(outputFilename), COleVariant((long)
xlWorkbookNormal), covOptional,
covOptional, covFalse, covFalse, *value for write*???, covOptional,
covOptional, covOptional,
covOptional, covOptional); // I have tried a few values for the write
value.
I keep getting an Error Message Box saying: "The file could not be
accessed" and a bunch of incorrect suggestions as to the cause of the problem.

Please help if you can!
Thanks in advance!

Aruk
 
G

Guest

Okay, I'm not sure what I changed, but it works now. (I think output filename
was getting wiped out after I set it, but before the function call, if so the
error message was correct after all).
I used CFile::modeWrite (value 0) for the access mode parameter, but other
than that the call is unchanged.
I hope this helps someone else.

Aruk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top