it prints if i get rid of the display alerts but i still see the dialog box, and it's the same when i use defaults on the print out line.
Main Topics
Browse All TopicsI am trying to make a button to print the current page, though many of the pages are outside of the printable page area so i want to get rid of the dialog "outside of the...do you wish to continue..." box. I tried to piece together some code but i get a 424 object required error on the last line. Can anyone help? Here is what i have.
Sub PrintCurr()
Application.DisplayAlerts = wdAlertsNone
ActiveDocument.PrintOut Background:=False, Range:=wdPrintCurrentPage
Application.DisplayAlerts
End Sub
Thanks
Brad
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
thanks for the help
the button is in one of my custom toolbars. the macro is located in a template which my document is built from. i tried to move the macro into the actual doc instead of the template but the same thing happened. when i run the debug the last line "Application.DisplayAlerts
Just a couple of totally random ideas to try....
since the value of the "wdAlertsAll" constant is -1, what happens if you try:
Application.DisplayAlerts = -1
Also, you should be able to leave off the "Application" part, so why not try:
Sub PrintCurr()
DisplayAlerts = wdAlertsNone
ActiveDocument.PrintOut Background:=False, Range:=wdPrintCurrentPage
DisplayAlerts = wdAlertsAll
End Sub
Although, I must say that I have also tested your original code, and like SQL_Stu, it worked perfectly on my machine. And I did test it on a document with margins out of range.
Business Accounts
Answer for Membership
by: SQL_StuPosted on 2004-09-07 at 08:32:41ID: 11997858
Have u tried commenting out the 2 displayalerts lines? Perhaps the problem lies in your remaining line of code? Have u tried the printout line just using defaults?
Otherwise, I can't see a lot wrong with the above.