ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook::SaveAs() in MFC - Please help! (https://www.excelbanter.com/excel-programming/337270-workbook-saveas-mfc-please-help.html)

ArukTheRed

Workbook::SaveAs() in MFC - Please help!
 
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



ArukTheRed

Workbook::SaveAs() in MFC - Please help!
 
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

"ArukTheRed" wrote:

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




All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com