Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Opening directory

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bernd Kuegle - 09 Feb 2005 16:32 GMT
Hi!

I would like to use a vba routine of my Excel where I can open a certain
directory ("G:\DATES\") to select a file but this doesn?t work in Word:

   ChDrive "G:\"
   ChDir "G:\DATES\"
   o_dir = Application.GetOpenFilename("Winword.exe (*.*), *.*")
   Workbooks.Open FileName:=o_dir

Thanks
Bernd
Rick Gutzmer - 09 Feb 2005 16:41 GMT
Change this line:
Workbooks.Open FileName:=o_dir
to this:
Documents.Open FileName:=o_dir

> Hi!
>
[quoted text clipped - 8 lines]
> Thanks
> Bernd
Rick Gutzmer - 09 Feb 2005 17:48 GMT
sorry - jumped the gun.  Try this:

 Dim o_dir As String
 o_dir = Options.DefaultFilePath(Path:=wdDocumentsPath)
 Options.DefaultFilePath(Path:=wdDocumentsPath) = "D:\syxta\templates"
 With Application.Dialogs(wdDialogFileOpen)
   .Name = "*.doc; *.rtf"
   .Show
 End With
 Options.DefaultFilePath(Path:=wdDocumentsPath) = o_dir
 Templates("normal.dot").Saved = True 'so you don't get prompted to save
the normal template on exit

> Hi!
>
[quoted text clipped - 8 lines]
> Thanks
> Bernd
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.