Word VBA's "wdDialogFilePrint.show" command sends to printer with no dialog

Has anyone seen this?  Whether I run as part of a macro or launch from the Immediate window, in some cases (can't figure out why), using Dialogs(wdDialogFilePrint).Show doesn't show the Print dialog at all, but sends the document to print automatically to currently selected printer with default options.
LVL 1
NGloFileAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joseph OLoughlinIT Support SpecialistCommented:
Hi NGloFile,
Is it a HP printer?  I have found their printer drivers buggy.  Try using a Microsoft driver for a similar model as your default (going to the same port)
usual disclaimers apply.  I'm away next week so don't expect a quick reply.
0
NGloFileAuthor Commented:
Thanks Atheist (like your handle!).

It's actually a Xerox printer, but I'd be surprised if it's a driver issue, since it's not affecting the result as much as behavior within the application (i.e., no dialog).  It seems to be redirecting the event of dialog.show to document.printout or something like that.
0
Joseph OLoughlinIT Support SpecialistCommented:
Can we review the vba?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

NGloFileAuthor Commented:
Sure.  But I should clarify two things:

1) This only happens sporadically, to certain users.  For others, it behaves as expected.
2) When it happens, you can re-create it just by going to the immediate window, typing "Dialogs(wdDialogFilePrint).Show and pressing Enter

The code:

Sub PrintToBond()

Dim myTray As String
Dim FirstPage As String
Dim OtherPage As String

' Get Current tray pages
FirstPage = ActiveDocument.Sections(1).PageSetup.FirstPageTray
OtherPage = ActiveDocument.Sections(1).PageSetup.OtherPagesTray

myTray = System.PrivateProfileString("", "HKEY_CURRENT_USER\software\whscripts", "Bond_Tray")

If myTray = "" Then

    myTray = "257"
   
End If

Dim sec As Section

For Each sec In ActiveDocument.Sections


    sec.PageSetup.FirstPageTray = myTray
    sec.PageSetup.OtherPagesTray = myTray
   
Next

System.PrivateProfileString("", "HKEY_CURRENT_USER\software\whscripts", "Bond_Tray") = myTray

Dialogs(wdDialogFilePrint).Show

' now set trays back
For Each sec In ActiveDocument.Sections


    sec.PageSetup.FirstPageTray = FirstPage
    sec.PageSetup.OtherPagesTray = OtherPage
   
Next


End Sub

Thanks.
0
Joseph OLoughlinIT Support SpecialistCommented:
See http:Q_20559573.html
or add
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
before
Dialogs(wdDialogFilePrint).Show
0
NGloFileAuthor Commented:
Thanks again.

Unfortunately, this didn't make a difference.  It doesn't seem to have any problem printing or printing the correct document.  Instead, it is just misinterpreting the command to show the dialog and going directly to print (almost like it's confusing the "File > Print ..." command with "File > Print" (no dialog options).

Thanks for trying, though.

NGloFile
0
NGloFileAuthor Commented:
It turns out that this issue was being caused by a third-party application we have installed that hijacks the _DocumentBeforePrint command.  We are working with the vendor on fixing this.

Thanks.
0
Joseph OLoughlinIT Support SpecialistCommented:
Intresting...
0
NGloFileAuthor Commented:
I went through the procedure identified above for closing a question because I answered it myself(and requesting a refund) back in December (by contacting the moderator).  We discovered the problem was caused by a third-party add-in we are using in Word.  Let me know if I need to do anything else.  Thanks.
0
moduloCommented:
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobertaGelbCommented:
THANK YOU!!! Just a note:  We had this experience with Word2007 and Interwoven FileSite 8.2.

 We deleted the line
                  Dialogs(wdDialogFilePrint).Show
and used Interwoven's  
                 AutoMacro.FilePrintBinding
 in its place

Requires that you set references (in Tools References) to IMan02K.dot
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.