macro@print

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to assign a macro to the print command? I want the macro to be launched when commanding print, just as a field may then be updated.
 
If the macro is called FilePrint, it will run in place of the built-in print
command. You can use Dialogs(wdDialogFilePrint) if you want to emulate the
built-in command under macro control.

You might also want to trap FilePrintDefault, which runs if the user clicks
the print toolbar button.


Ian said:
Is it possible to assign a macro to the print command? I want the macro
to be launched when commanding print, just as a field may then be updated.
 
G'Day Ian,

In Word you intercept a Command by creating a
macro WITH THE SAME NAME.

See Tools>Macro>Macros
In the "Macros in:" dropdown select "Word commands"

You would typically do something like:

Sub FilePrintDefault()
' Toolbar 'Print' button
'
' Do your thing here
'
ActiveDocument.PrintOut
End Sub

and

Sub FilePrint()
' File>Print Menu Item
'
' Do your thing here
'
Application.Dialogs(wdDialogFilePrint).Display
' YOU must process the Dialog YOURSELF
' to carry out the PRINT or CANCEL etc that the
' USER chooses
End Sub
--
Regards,
Pat Garard
Australia

______________________________________
 
Thank you both..
If I understand it correctly, customizing the fileprint command will change printing for all files
Is it possible to localize it to a specific file

Ian
 
Attach the macro to the document rather than to normal.dot. It will still
run for any print request while the document is open, but not otherwise.
And/or design the macro so that it checks which document is active when it
is called ... if not the subject document, then your macro can behave like
the normal print command.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top