I don't want the Excel workbook to be visible to the users

vb.net , excel , interop India
  • 12 years ago
    I have a VB.NET application and I am using following code to work on an existing Excel file. Private xlApp As Excel.ApplicationClass Private xlWbk As Excel.Workbook xlApp.Visible = False xlApp.DisplayAlerts = False xlWbk = xlApp.Workbooks.Open("c:\xlWbk.xls") While the application is running I don't want the Excel workbook to be visible to the users. As long as I am not opening an external Excel file (outside the application), everything works fine. However, when i am opening an external Excel file say, "a.xls", I can see my xlWbk.xls very much visible in front of me! This is 'dangerous' for the application as if the user closes this file, the application will cease to work! Is there a way I can hide the Excel file the application is using.. and still work on another external Excel file? Seems like the external Excel workbook is using the same instance of xlApp that was generated thru the code. So when i close any of the Excel files, the above application throws exceptions. Is there a workaround for the above? Thanks.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook