I have this code (in print preview button) for opening a print preview and printing a Word doc:


Dim wApp As Object
Const wdAlertsNone = 0

Set wApp = CreateObject("Word.Application")

With wApp
.DisplayAlerts = wdAlertsNone
.Visible = True
.Documents.Open FileName:=strfile, ReadOnly:=False, AddToRecentFiles:=False
.ActiveDocument.PrintPreview

.ActiveDocument.Close False
.Quit
End With

Set wApp = Nothing



What happens is when I click that button, a print preview is shown but still my VB6 application is accessible, and I have close the print preview and the word doc manually.

What I want is similar to printing an Excel file; that is when I hit print preview button, the print preview is displayed, my application will be inaccessible until I click print or close the print preview dialog. And also when I've already printed the document, that particular Word window/document will close.

Please help. Thank you!