Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Printer Based on Criterea
We currently have an excel order form that we are using and there are two
different printers that it can be printed to. Here is what I would like to do: I would like a macro that would bring up a message box stating "Do you have anything to attach to this order?" and then the options of "Yes" and "No". The option that they select would determine what printer their form would print on. Is this possible? Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Printer Based on Criterea
Does everyone connect to the printer using the same string?
Sometimes, people can connect using different strings: \\someserver\someprintername on NE01: or \\someserver\someprintername on NE02: or.... If different names can be used, then this won't work--but there may be work-arounds. Option Explicit Sub testme() Dim Resp as long dim CurPtr as string dim OtherPtr as string curptr = application.activeprinter resp = msgbox(Prompt:="Attachments?", buttons:=vbyesno) if resp = vbyes then application.activeprinter = "\\yourstringforthatprinterhere" else 'do nothing or change to a different printer??? application.activeprinter = "\\adifferenterprinterhere???" end if 'do the printing worksheets("sheet99999").printout 'change the printer back to the user's choice application.activeprinter = curptr End sub Uncompiled and untested. Watch for typos. pt_lily wrote: We currently have an excel order form that we are using and there are two different printers that it can be printed to. Here is what I would like to do: I would like a macro that would bring up a message box stating "Do you have anything to attach to this order?" and then the options of "Yes" and "No". The option that they select would determine what printer their form would print on. Is this possible? Thanks! -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Printer Based on Criterea
Yes, they are all using the same string.
"Dave Peterson" wrote: Does everyone connect to the printer using the same string? Sometimes, people can connect using different strings: \\someserver\someprintername on NE01: or \\someserver\someprintername on NE02: or.... If different names can be used, then this won't work--but there may be work-arounds. Option Explicit Sub testme() Dim Resp as long dim CurPtr as string dim OtherPtr as string curptr = application.activeprinter resp = msgbox(Prompt:="Attachments?", buttons:=vbyesno) if resp = vbyes then application.activeprinter = "\\yourstringforthatprinterhere" else 'do nothing or change to a different printer??? application.activeprinter = "\\adifferenterprinterhere???" end if 'do the printing worksheets("sheet99999").printout 'change the printer back to the user's choice application.activeprinter = curptr End sub Uncompiled and untested. Watch for typos. pt_lily wrote: We currently have an excel order form that we are using and there are two different printers that it can be printed to. Here is what I would like to do: I would like a macro that would bring up a message box stating "Do you have anything to attach to this order?" and then the options of "Yes" and "No". The option that they select would determine what printer their form would print on. Is this possible? Thanks! -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Printer Based on Criterea
Then I think that the suggested code will work.
pt_lily wrote: Yes, they are all using the same string. "Dave Peterson" wrote: Does everyone connect to the printer using the same string? Sometimes, people can connect using different strings: \\someserver\someprintername on NE01: or \\someserver\someprintername on NE02: or.... If different names can be used, then this won't work--but there may be work-arounds. Option Explicit Sub testme() Dim Resp as long dim CurPtr as string dim OtherPtr as string curptr = application.activeprinter resp = msgbox(Prompt:="Attachments?", buttons:=vbyesno) if resp = vbyes then application.activeprinter = "\\yourstringforthatprinterhere" else 'do nothing or change to a different printer??? application.activeprinter = "\\adifferenterprinterhere???" end if 'do the printing worksheets("sheet99999").printout 'change the printer back to the user's choice application.activeprinter = curptr End sub Uncompiled and untested. Watch for typos. pt_lily wrote: We currently have an excel order form that we are using and there are two different printers that it can be printed to. Here is what I would like to do: I would like a macro that would bring up a message box stating "Do you have anything to attach to this order?" and then the options of "Yes" and "No". The option that they select would determine what printer their form would print on. Is this possible? Thanks! -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
select printer macro | Excel Worksheet Functions | |||
How do I select printer using VBA? | Excel Programming | |||
Dynamically select a Printer | Excel Programming | |||
using vb to select which printer to use | Excel Programming | |||
select printer | Excel Programming |