Excel Automation ? Excel Attaches itself to my Excel Object!

  • Thread starter Darren Barrick via .NET 247
  • Start date
D

Darren Barrick via .NET 247

Hello All!

I am using Office Automation in one of my applications in orderto read/write to an excel spreadsheet from a VB.Net application.

I thus create the application with

ExcelApplication = New Excel.Application()

I wish to keep my application hidden, and thus I use

ExcelApplication.Visible = False

This all works fine. Excel stays hidden (although it does show inthe process list ? I can live with this). However, the problemoccurs when the user loads a workbook outside of my application.

Excel attaches itself to my ExcelApplication Object !! What?sworse is that it makes my currently hidden workbook visible.

Initially I considered that I could just hide individualworkbooks. However, there are two problems with this approach.
1. I with to set ExcelCalculation to manual, and this is anapplication wide property. If I allow Excel to attach itself tomy excel object then I will have no choice but to setExcelCalculation to automatic, slowing things down (some of thecalculations being performed by excel are fairly involved)
2. When the user closes the application (with hidden workbooks),the process will die. I can always check for this and reloadexcel ? but this is an acquired solution and it will becompounded by the calculation issues described in (1).

Ideally, what I want to do is stop Excel attaching itself to myExcel instance. However, any suggestions would be more thanwelcome.

Thank you in advance

Darren Barrick
 
D

Darren Barrick

RESOLVED

xlApp.IgnoreRemoteRequests = True

http://www.xtremevbtalk.com/showthread.php?p=997013#post997013

Hello All!

I am using Office Automation in one of my applications in order to
read/write to an excel spreadsheet from a VB.Net application.

I thus create the application with

ExcelApplication = New Excel.Application()

I wish to keep my application hidden, and thus I use

ExcelApplication.Visible = False

This all works fine. Excel stays hidden (although it does show in the
process list ? I can live with this). However, the problem occurs when the
user loads a workbook outside of my application.

Excel attaches itself to my ExcelApplication Object !! What?s worse is that
it makes my currently hidden workbook visible.

Initially I considered that I could just hide individual workbooks. However,
there are two problems with this approach.
1. I with to set ExcelCalculation to manual, and this is an application wide
property. If I allow Excel to attach itself to my excel object then I will
have no choice but to set ExcelCalculation to automatic, slowing things down
(some of the calculations being performed by excel are fairly involved)
2. When the user closes the application (with hidden workbooks), the process
will die. I can always check for this and reload excel ? but this is an
acquired solution and it will be compounded by the calculation issues
described in (1).

Ideally, what I want to do is stop Excel attaching itself to my Excel
instance. However, any suggestions would be more than welcome.

Thank you in advance

Darren Barrick
 

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