Set printer Excel vba macro
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
add a comment |
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
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
add a comment |
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
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
microsoft-excel vba macros
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
|
show 2 more comments
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
|
show 2 more comments
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
|
show 2 more comments
You can add the ActivePrinter as an argument to PrintOut.
For example:
Worksheets("Sheet1").PrintOut ActivePrinter:="DYMO LabelWriter 450 (Copy2) on JCSP55J"
You can add the ActivePrinter as an argument to PrintOut.
For example:
Worksheets("Sheet1").PrintOut ActivePrinter:="DYMO LabelWriter 450 (Copy2) on JCSP55J"
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
|
show 2 more comments
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
|
show 2 more comments
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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