Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop SQL screen prompt

Status
Not open for further replies.

BradleyS64

Technical User
Nov 4, 2011
1
GB
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
 

Did you try:
[tt]
Sub PrintDefault()
'
' PrintDefault Macro
' Print current document to Default Printer
'[blue]
Application..DisplayAlerts = False[/blue]
....

ActiveDocument.PrintOut
ActiveDocument.Saved = True
ActiveDocument.Close
Application.Quit

End Sub
[/tt]

Have fun.

---- Andy
 
Be aware that it looks like you are actiually using VBA rather than VB. You'll be better off posting future questions in forum707
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top