0

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!

diiN__________
  • 7,393
  • 6
  • 42
  • 69
alpensturm
  • 39
  • 3
  • 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 folder – PetLahev Sep 29 '16 at 09:14

1 Answers1

0

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

Community
  • 1
  • 1
Chris
  • 3,400
  • 1
  • 27
  • 41