Visual Basic Help..Printing (1 Viewer)

adgala

Member
Joined
Oct 27, 2004
Messages
111
Location
Sydney
Gender
Male
HSC
2006
Hi everybody..i would like to know how to print word documents through visual basic e.g. the user presses a command button which then prints out a particular word document (which i've pre-made) to the default printer. thanks in advance
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Try the ShellExecute API for starters. Since you haven't said which version of VB you are using....

VB6
Code:
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
VB.NET
Code:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"(ByVal hwnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer
Use "print" for lpOperation.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top