BradleyS64
Technical User
Hi I have a bit of basic code shown below which when I open the document it prints it and closes it and it works fine.
However on some of the documents I have merge fields and I get the following screen prompt appear when it is initially opened:
************************************************************
Opening this document will run the following SQL command:
SELECT * FROM BLAH BLAH BLAH
Data from your database will be placed in this document.
Do you wish to continue?
YES or NO
************************************************************
Can I add something to the VB code below to stop this screen prompt or make it select the NO option?
Sub PrintDefault()
'
' PrintDefault Macro
' Print current document to Default Printer
'
ActiveDocument.PrintOut
ActiveDocument.Saved = True
ActiveDocument.Close
Application.Quit
End Sub
However on some of the documents I have merge fields and I get the following screen prompt appear when it is initially opened:
************************************************************
Opening this document will run the following SQL command:
SELECT * FROM BLAH BLAH BLAH
Data from your database will be placed in this document.
Do you wish to continue?
YES or NO
************************************************************
Can I add something to the VB code below to stop this screen prompt or make it select the NO option?
Sub PrintDefault()
'
' PrintDefault Macro
' Print current document to Default Printer
'
ActiveDocument.PrintOut
ActiveDocument.Saved = True
ActiveDocument.Close
Application.Quit
End Sub