Select Printer Based on Criterea

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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.
 
Yes, they are all using the same string.

Dave Peterson said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top