0

I want to start Microsoft Office with Process.Start(path) of C#. But I couldn't do it because I don't know the path of the Office.exe(What I want to start is not Office programs like powerpoint, excel etc, but the collection app of them.)enter image description here

Is there any way to open it with c# code?

Sorry for my bad English explanation.

Hans Kesting
  • 38,117
  • 9
  • 79
  • 111
null
  • 29
  • 3
  • 1
    Hmmm. I use Microsoft Office as well, but I cannot find such an Office overview app on my machine. Is it a separately installed app? Can you explain how you start it manually? Is it included in the Windows start menu somewhere? – Bart Hofland May 02 '21 at 08:53
  • Ah. I found it in the Microsoft Store. I have installed it and it looks like your screenshot, so I guess it's the correct app. https://www.microsoft.com/en-us/p/office/9wzdncrd29v9 And now I also understand your issue. Windows 10 (UWP) apps are not executable files and it seems to be a pain in the *ss to start them from a command prompt, or from a script. Or from a C# app... ;) – Bart Hofland May 02 '21 at 09:19
  • Does this answer your question? [How to automate Outlook?](https://stackoverflow.com/questions/38404395/how-to-automate-outlook) – Eugene Astafiev May 02 '21 at 10:59

1 Answers1

1

The path to the Office application can be found via the windows registry. If you use the registry you have two options (depending on the version of OS you have).

  1. Retrieve InstallRoot for Microsoft Office by looking here (XX.X should be replaced with Office Version, 12.0, 14.0, 16.0 etc):
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\XX.X\Common\InstallRoot
Value is stored the the String value "Path".
  1. Retrieve the Registered App Path for OUTLOOK.EXE here:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE
Value is stored in the String value "Path".

But for store editions of MS Office you can find settings in the virtual keys (for all of the Office apps) are stored in User.dat file at C:\Users\%username%\AppData\Local\Packages\Microsoft.Office.Desktop_8wekyb3d8bbwe\SystemAppData\Helium. Read more about that in the Outlook Windows Store Registry article. Using a registry tracker, discovered at least some of the keys were written to HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\.

If you have the store version, the applications are under C:\Program Files\WindowsApps\*.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45