Can't close Excel workbook

steveosmith

New member
Joined
Mar 8, 2004
Messages
2
Hi all,
Just stumbled upon this forum. Anticipate spending MANY hours here. Anyway, Im having problems closing an Excel workbook from within my vb.net app. I use a web browser to host an instance of Excel, which Im accessing thru the PIAs. To over-symplify, I open a file in the web browser, set an instalnce of Excel to equal that file, then maniuplate it thru my Excel instance. I can open files, add or remove pages, edit cells, etc., but I cant close a file.

Seems like I could use:
xlapp.ActiveWorkbook.Close
The code runs, but the workbook still shows in my web browser. And if I loop thru every workbook in xlapp, its still there as well.

Ive also tried:
xlApp.ActiveWindow.Close
but get a type mismatch error.

I cant imagine this would be too hard, or else Id be seeing other posts referring to the same thing. Anyone have an idea of what Im missing?

Thanks in advance,
Steve.
 
Back
Top