issue printing a word document from excel after selecting a printer

sdel_nevo

New Member
Joined
Jan 16, 2015
Messages
28
Hi Guys

I Have an issue with he code below that i have been struggling with for a while, what i want to do is print a word document to a printer that has been selected

Rich (BB code):
Dim objWord
    Dim objDoc
    Set objWord = CreateObject("Word.Application")
    Set objDoc = objWord.Documents.Open("\\server1\tests\testresults.doc")
    objWord.Visible = False
    ' First choose a printer by using the printer select window, then we print out the document
    Application.Dialogs(xlDialogPrinterSetup).Show
    
    
    objDoc.PrintOut
   
    ' The Code Below Shows a Message Box Confirming That The Document Has Been Printed
    MsgBox "Your Document Has Been Printed"
    
    
    
    'then we quit word
    objWord.Quit
    
    'then we release the memory that word has been using
    Set objDoc = Nothing
    Set objWord = Nothing

after selecting a new printer the word document is alsways printed to the pc's default printer, not the one that has just been selected.

if i change

Application.Dialogs(xlDialogPrinterSetup).Show

to

Application.Dialogs(xlDialogPrint).Show

after changing the printer there its still printing to the defualt printer as well


any help would be fantastic

Steve
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Although I've not used these dialogs before, I am pretty sure that whats happening is the printer selection is changing IN EXCEL, and whatever settings are in Word are remaining unchanged.
 
Upvote 0
Hi

sorry for the late reply

that makes sense, i have solved this by adding the requierd changes on the word document not the excel sheet

many thanks for the pointer

Steve
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,617
Latest member
Narendra Babu D

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top