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

Tip: Looking for answers? Try searching our database.

Macro - dialog box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MIrving - 10 Dec 2007 04:49 GMT
Is there a standard macro/code I can use (or modify) for entering a filename
in the dialog box that appears when either saving as/printing?

I tried using the 'Record new macro' and stepped through the steps.  
However, it didn't seem to recognise the step when I clicked in the dialog
box to type the filename.  When I go to visual basic editor to view the
macro, there is nothing that reflects a step of clicking in the dialog box
and putting in the filename.  

Thank you for any suggestions.
Graham Mayor - 10 Dec 2007 09:33 GMT
The filename would be taken from the document property Title. You can write
to that property, and use that as the filename, eg

Dim sTitle As String
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle).Value = "Filename"
sTitle = ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)
ActiveDocument.SaveAs FileName:=sTitle

but if you know the filename you want to use why call the dialog at all.

ActiveDocument.SaveAs FileName:="Filename"

The print dialog does not recall the file name.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Is there a standard macro/code I can use (or modify) for entering a
> filename in the dialog box that appears when either saving
[quoted text clipped - 7 lines]
>
> Thank you for any suggestions.
MIrving - 10 Dec 2007 09:46 GMT
Thank you for your suggestions.  The macro I want to set up is to enable a
user to click a toolbar button to print the Word document to PDF995.  When I
go to File > Print and select PDF995 as the printer, a separate dialog box
then appears which is 'PDF995 save as'.  It is in that dialog box that I
would like the filename to be inserted automatically.  The filename is to be
taken from a bookmark in the word document.  The bookmark will vary depending
on what client name the user inserts.

Thank you for any further suggestions you can offer as to how I can achieve
this (if it is possible) or a code that does anything similiar that I could
play around with to suit.

> The filename would be taken from the document property Title. You can write
> to that property, and use that as the filename, eg
[quoted text clipped - 21 lines]
> >
> > Thank you for any suggestions.
Graham Mayor - 10 Dec 2007 10:20 GMT
I have not previously used PDF995 , but the free PDF creation tools are not
usually programmable from within Word and usually require some user
intervention. To achieve this you would probably have to upgrade to Acrobat,
but by all means check with the writers of PDF995. However having checked
with the free version, it picks up the filename pf the document
automatically, and appears to retain the last destination folder for the
files. Thus the following should work

Sub PrintPDF()
Dim sPrinter As String
sPrinter = ActivePrinter
ActivePrinter = "PDF995"
   Application.PrintOut
   ActivePrinter = sPrinter
End Sub

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Thank you for your suggestions.  The macro I want to set up is to
> enable a user to click a toolbar button to print the Word document to
[quoted text clipped - 44 lines]
>>>
>>> Thank you for any suggestions.
 
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.