-
Apr 17th, 2015, 10:03 PM
#1
Thread Starter
Hyperactive Member
Auto-close Word after printing
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|