Using the following code I can run Excel from within C#:
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.Start();
Can I make Excel start hidden or minimized using any command line parame开发者_开发问答ters?
(Edit: Tried p.StartInfo.WindowStyle
and it had no effect.)
I need to start Excel without using COM because when starting Excel over COM, none of the XLA add-ins are loaded.
You can set the WindowStyle
property to Minimized
or Hidden
. Like the following:
ProcessStartInfo p = new ProcessStartInfo("excel.exe");
p.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(p);
精彩评论