Im trying to print through a macro to a shared printer on a colleagues PC.

I have tried the following but to no avail

Sub Tag()
ActiveCell.Resize(1, 1).Copy Worksheets("Sheet1").Range("A1")

ActiveCell.Offset(, 1).Resize(1, 1).Copy Worksheets("Sheet1").Range("A2")

'Worksheet("Sheet1").Range("A1:A2").Borders.LineStyle = xlNone
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Worksheets("Sheet1").Range("A2").WrapText = True
Worksheets("Sheet1").Range("A2").Font.Size = 44
Worksheets("Sheet1").Range("A2").ShrinkToFit = True

Application.ActivePrinter = "Microsoft XPS Document Writer on XPSPort"

'Worksheets("Sheet1").PrintOut ActivePrinter = "DYMO LabelWriter 450 (Copy2) on JCSP55J"

End Sub

the JCSP55J is the colleagues network name.

any ideas how to solve this please?

  • Try to record a macro. It'll show the correct name and syntax. – Máté Juhász Mar 16 '16 at 15:10
  • I have tried to record the macro but it does not show activeprinter, – Ryanagray Mar 16 '16 at 15:15

You can add the ActivePrinter as an argument to PrintOut.

For example:

Worksheets("Sheet1").PrintOut ActivePrinter:="DYMO LabelWriter 450 (Copy2) on JCSP55J"
  • HI, this still gives the same error, Run-Time error '1004': Method 'ActivePrinter' of object'_Global' failed – Ryanagray Mar 16 '16 at 15:58
  • @Ryanagray That occurs if you're using the wrong name. Make sure you're using the name from the first box in "Printing Preferences" exactly as it occurs. i.imgur.com/KhBkTdT.jpg – Jonno Mar 16 '16 at 16:00
  • Thanks for the reply, I have tried this and still the same, does it make a difference it been a shared printer on another PC usb port – Ryanagray Mar 16 '16 at 16:16
  • @Ryanagray Shouldn't do, it's only using the name to interface. Perhaps rename the printer device to something simpler to be sure, just "DYMO" or something – Jonno Mar 16 '16 at 16:17
  • I have tried with other printers and still the same, I have edited the question above to include all the macro code, any more thoughts please? – Ryanagray Mar 16 '16 at 16:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.