1
votes

I have noticed that when users have the Windows file explorer preview pane enabled and then view a Word or Excel file, that my VSTO addin is started. Further my addin starts again when the user double clicks on a excel or word file.

What properties in Word and Excel do I need to check at startup to know that it is the preview pane?

For people's reference I did find a discussion on this for Powerpoint in this SO question.

2

2 Answers

1
votes

When Word and excel are started by the file explorer as a preview then what I have found is that you can check for a commandlinearg of -Embedding

Environment.GetCommandLineArgs().Contains("-Embedding"))

Detecting Automation of Excel is where I found this answer. This question is about automation.

Also when a user embeds for example Excel in Word and then edits the embedded Excel the VSTO addin will start multiple times. You can check for the -Embedding arg for this as well.

0
votes

Typically the ribbon bar is not visible when Office applications are used for rendering documents in the Windows explorer. You may use the following code to check that:

Application.CommandBars("Ribbon").Visible