tags:

views:

154

answers:

1

Hi,

I have created an application to interact with Excel in C#.net The API to save the Excel

 Excel._Workbook m_oWorkBook;  
 m_oWorkBook.Save();

Throws up a File Saveas MessageBox though the workbook was already saved in a given name.

Note: This happens only in Windows 7 & only when another Workbook was already opened.

Any clues.

A: 

I don't know much (if anything at all) about CSharp's Excel API, but seeing as nobody else has tried to answer this question yet I can't say you have any better options. : )

Having perused some documentation, I have found that the Excel._Workbook.SaveAs() method allows you to specify a filename, among other things. If it is true that the Save() method is only opening the SaveAs dialog on Win7, it could very well just be a bug in Win7. I would suggest, to temporarily avoid this bug, you should use the SaveAs() method instead of Save(). All parameters are optional and filename is the first one, so you could hypothetically just pass it the filename of the current file and that should achieve the same functionality as is intended from Save().

IF this is a bug in Windows 7, I think this would be the best/least painful way to get around it. Hopefully this helps.

JMTyler
Karthik
Ah, sorry I couldn't have been more help on the Save/SaveAs issue.This is a very odd problem, though, as it works fine in Vista. I fully expect it must be some kind of bug in the Win7 API. Are you making any Remote Procedure calls? If not, I find it kind of scary that Microsoft would feel the need to put RPC into their *Excel* API...
JMTyler