ID: 144
Viewed: 3091
Added: Apr 28, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
need to print a Microsoft Word Document but I have to initiate
the printing fom within vb.
Normally I can print a document by going to explorer then right click on the document then choose print from the pop-up menu, but how
can I print the document from VB
Use the ShellExecute API function.
Highlight all by clicking in box
<!---Declaration--->
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL = 1
'Usage
Highlight All
<!---Code--->
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Print", "C:WordDoc.doc", vbNullString, "c:",SW_HIDE 'or SW_SHOWNORMAL
End Sub;
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.