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

You can use a switch option on the command line such as

excel /safe

More options are shown on the microsoft web page

http://office.microsoft.com/en-us/ex...580301033.aspx

" wrote:

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);
...
}