View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default How to get "/automation" when automating?

When you start Excel via automation, which I believe you're doing, the
/automation switch is automatically applied (thus the name).

For unbelievers put this in a VBS file and run it:

Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open "c:\Book1.xls", 3
XL.Visible = True

Note that no add-ins, Personal.xls, etc. are opened.

and I am having issues with auto-run macros.


If you're opening a workbook subsequently of course its events will run.
Maybe you should expand on the issues you're having.

--
Jim
wrote in message
oups.com...
| According to MS, the /automation switch for Excel disables all
| automatically opened files and auto-run macros. You get this feature
| when starting Excel like "excel.exe /automation". But, I am starting
| Excel from a C# program, not a command line, and I am having issues
| with auto-run macros. How can I disable the auto-run macros when
| actually automating Excel? A snippet of my code is below.
|
| Thanks,
| Mike
|
| *************
|
| MSExcel.Application app = new MSExcel.Application();
| try
| {
| app.Workbooks.Open(filePath, Missing.Value, Missing.Value,
| Missing.Value,
| Missing.Value, Missing.Value, Missing.Value, Missing.Value,
| Missing.Value,
| Missing.Value, Missing.Value, Missing.Value, Missing.Value,
| Missing.Value,
| Missing.Value);
| ...
| }
|