ShellEx: Starting Excel minimized or hidden

2019-07-13 07:58发布

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 parameters?

(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.

1条回答
混吃等死
2楼-- · 2019-07-13 08:53

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);
查看更多
登录 后发表回答