Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 144
Viewed: 2601
Added: Apr 28, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

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
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


Highlight All
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.

Replying to a Comment...

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.

© 2002 - 2017 All Rights Reserved. Conditions