Added: Apr 28, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
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
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
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Print", "C:WordDoc.doc", vbNullString, "c:",SW_HIDE 'or SW_SHOWNORMAL
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.