开发者

ShellEx: Starting Excel minimized or hidden

开发者 https://www.devze.com 2023-01-16 11:59 出处:网络
Using the following code I can run Excel from within C#: System.Diagnostics.Process p = new System.Diagnostics.Process();

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消