PLEASE HELP ! Macro

  • Thread starter Thread starter Preet
  • Start date Start date
P

Preet

Any help would be most appreciated!


How would I say in a macro

"IF the user clicks on FilePrint or on Print, THEN close the document
without any changes"

also

"IF the user clicks on Exit, THEN close the document without any
changes"

But the code below - Automatically brings the dialogue box up - I want
the user to go to the dialogue box if they want:

With Dialogs(wdDialogFilePrint)
If .Display = -1 Then
ActiveDocument.Close wdDoNotSaveChanges, wdOriginalDocumentFormat,
False
..Execute
End If
End With
 
Hi Shauna

Thank you for your response.

If I use the following:

Sub AutoClose ()

If Application.Dialogs(wdDialogFilePrint) Then
ActiveDocument.Close wdDoNotSaveChanges, wdOriginalDocumentFormat
False
End If

End Sub


This should Close on Printing of the word document, (but the documen
will print first)

I am new to VB, so if this is completely wrong, apologies in advance!

Thank you and hope to hear from you soon.

Pree
 
Back
Top