Printing to a specific Printer

Bigbadborris

Active member
Joined
Aug 21, 2013
Messages
35
Programming Experience
Beginner
Hi All

I have a project that I have been working on (may have seen it referenced in other posts). Im learning loads creating it (thanks to everyone on here that has helped)
I stuck again though. My project uses a Microsoft word Templete to create service letters, I have managed to get the program to populate the bookmarks on the word doc.
I would l like the doc to print to a different printer ( \\DRIPOOLSERVER\LexmarkE232 ) than the default printer as soon as its been populated with the data.
This is what I have so far

VB.NET:
        ' Opens the Service Letter template and populates it with the customer details.
        Dim objWdDoc As Object
        Dim objWord As Object
        objWord = CreateObject("Word.Application")
        objWdDoc = objWord.Documents.Add("C:\DRITXT\Service.docx")
        objWord.Visible = False


        objWdDoc.Bookmarks.Item("Name").Range.Text = Title & " " & CustName
        objWdDoc.Bookmarks.Item("Add1").Range.Text = Add1
        objWdDoc.Bookmarks.Item("Add2").Range.Text = Add2
        objWdDoc.Bookmarks.Item("Add3").Range.Text = Add3
        objWdDoc.Bookmarks.Item("Add4").Range.Text = Add4
        objWdDoc.Bookmarks.Item("County").Range.Text = County
        objWdDoc.Bookmarks.Item("PostCode").Range.Text = PostCode
        objWdDoc.Bookmarks.Item("Dear").Range.Text = Title & " " & CustName

        objWdDoc.printout()

The doc prints but it prints to the default printer.
how can i send it to the differnet printer.

Many Thanks
 
Thats great I had seen this page but couldnt get it to work, but I have found were i went wrong ( small typo )

Thanks again for you help with this and other posts. This forum has taught me more than any book.
 

Latest posts

Back
Top