Set printer Excel vba macro












0















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
Sheets("Sheet1").Select
Range("A1:A2").Select
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?










share|improve this question

























  • 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
















0















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
Sheets("Sheet1").Select
Range("A1:A2").Select
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?










share|improve this question

























  • 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














0












0








0








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
Sheets("Sheet1").Select
Range("A1:A2").Select
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?










share|improve this question
















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
Sheets("Sheet1").Select
Range("A1:A2").Select
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?







microsoft-excel vba macros






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 16 '16 at 16:23







Ryanagray

















asked Mar 16 '16 at 15:00









RyanagrayRyanagray

28126




28126













  • 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



















  • 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

















Try to record a macro. It'll show the correct name and syntax.

– Máté Juhász
Mar 16 '16 at 15:10







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





I have tried to record the macro but it does not show activeprinter,

– Ryanagray
Mar 16 '16 at 15:15










1 Answer
1






active

oldest

votes


















0














You can add the ActivePrinter as an argument to PrintOut.



For example:



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





share|improve this answer
























  • 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








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1053641%2fset-printer-excel-vba-macro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You can add the ActivePrinter as an argument to PrintOut.



For example:



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





share|improve this answer
























  • 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
















0














You can add the ActivePrinter as an argument to PrintOut.



For example:



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





share|improve this answer
























  • 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














0












0








0







You can add the ActivePrinter as an argument to PrintOut.



For example:



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





share|improve this answer













You can add the ActivePrinter as an argument to PrintOut.



For example:



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






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 16 '16 at 15:22









JonnoJonno

17.7k44663




17.7k44663













  • 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



















  • 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

















HI, this still gives the same error, Run-Time error '1004': Method 'ActivePrinter' of object'_Global' failed

– Ryanagray
Mar 16 '16 at 15:58







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





@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





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





@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





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


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1053641%2fset-printer-excel-vba-macro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How do I know what Microsoft account the skydrive app is syncing to?

Grease: Live!

When does type information flow backwards in C++?