0
votes

I need to intercept an event before the Word Open File dialog is displayed. Specifically, I need to set the document path when the Open File dialog opens. The event Word.Application.DocumentOpen is too late, and I also cannot use the .NET Framework OpenFileDialog.

I could call:

Word.Application.ChangeFileOpenDirectory("C:\\tmp");

But this only works for the first time the Open File dialog is displayed, if called in ThisAddIn_Startup. If I open a second document, the previous path is suggested.

Any suggestions? Thanks!

1
If I remember correctly I was doing that the way that I override the Open command (Ribbon) and then I used the OpenFile dialog with my path and default folderPetLahev

1 Answers

0
votes

This isn't an answer, but maybe it will help you. I do the following to set the default filename in the Save As dialog:

dynamic dialog = Application.Dialogs[WdWordDialog.wdDialogFileSummaryInfo];
dialog.Title = titleTag.tag_content; // changes the default filename
dialog.Execute();

There may be a similar property you can change for the starting folder for the Open dialog. To be honest, I don't know where the Title property is defined.

I got this info from here: How to set the file name of a word document without saving it from c# and automation