Link to home
Start Free TrialLog in
Avatar of HeneganIS
HeneganISFlag for United States of America

asked on

How to get/set directory for Word dialog box using VSTO

C#
VS 2013
VSTO
Word 2013


I am able to call the Word 2013 File Open dialog box.  What I would like to do is to set the directory before opening up the dialog box.

For example I would like to set the directory to
\\Server\datashare\clients\Client1

so that when the File Open dialog box opens they will be at the Client1 folder.   This is an example, there can be hundreds to different clients.

The following shows the File Open dialog box, but it opens to whatever directory Word last used.

Word.Dialog dlg = Globals.ThisAddIn.Application.Dialogs[Word.WdWordDialog.wdDialogFileOpen];
       
dlg.Show();

Anyone have any suggestions?   Thanks.
Avatar of Rgonzo1971
Rgonzo1971

Hi,

pls try
Word.Dialog dlg = Globals.ThisAddIn.Application.Dialogs[Word.WdWordDialog.wdDialogFileOpen];
dlg.Name = "\\Server\datashare\clients\Client1\";
dlg.Show();

Open in new window

Regards
Avatar of HeneganIS

ASKER

.Name is not an option for the Dialog interface.
ASKER CERTIFIED SOLUTION
Avatar of HeneganIS
HeneganIS
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It works.