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 / January 2007

Tip: Looking for answers? Try searching our database.

How to use the Dialogs object and wdDialogFileSaveAs to actually save a file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
eholz1 - 15 Jan 2007 19:52 GMT
Hello Word Group,

I thought the above task would be easy.  Wrong.  (at least not for
me!).
No prob using activedocument.save or saveas.

I would like to present the user with a dialog window, so the user can
save a file (in *.doc format only)
but be able to name it as the user desires, and put it where the user
desires.

I would like to do this from vba.

I have the following code which opens (show) a dialog window, but it
opens to the *.dot filetype,
I can navigate to "C:\My documents", but the file is never saved.

code is below:

Sub ShowSaveAsDialog()
   Dim dlgSaveAs As Object
  ' Dim ePath As String

   'ePath = "C:\My Documents\"
   Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)
   dlgSaveAs.Show

End Sub
(i have tried dlgSaveAs.Execute - it errors out.

I want this code to be in a module in a custom template (as opposed to
Normal.dot),

any tips on this one???

thanks

ewholz
Jay Freedman - 15 Jan 2007 20:53 GMT
If you're testing the macro by running it while the template is the "current
document", that's the problem. Word "knows" when you're saving a template,
and it will force the SaveAs dialog to the User Templates folder. It also
won't let you save a template as a .doc file -- a template is always a
template, as far as Word is concerned.

Try running the macro while a plain document is active, and it should behave
the way you expect.

For some background and other help, see
http://www.word.mvps.org/FAQs/MacrosVBA/WordDlgHelp.htm,
http://www.word.mvps.org/FAQs/MacrosVBA/ChangeSaveAsPath.htm, and
http://www.word.mvps.org/FAQs/MacrosVBA/SetDefFilename.htm.

Signature

Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

> Hello Word Group,
>
[quoted text clipped - 34 lines]
>
> ewholz
eholz1 - 16 Jan 2007 17:35 GMT
Hello Jay et al,

I got it sorted out (at least for the time being).  Thanks for the
information and the links!

ewholz

> If you're testing the macro by running it while the template is the "current
> document", that's the problem. Word "knows" when you're saving a template,
[quoted text clipped - 55 lines]
> >
> > ewholz
 
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.