Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
select printer macro jatman Excel Worksheet Functions 1 March 15th 08 01:58 PM
How do I select printer using VBA? JS Excel Programming 2 May 19th 06 12:32 AM
Dynamically select a Printer Bill Agee Excel Programming 2 November 4th 04 02:03 PM
using vb to select which printer to use HCS Excel Programming 1 October 21st 04 12:58 PM
select printer Mark[_17_] Excel Programming 4 February 11th 04 02:28 PM


All times are GMT +1. The time now is 11:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"