Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to assign a printer to a workbook

Hi there,

I have a various workbooks that when I open I would like
to be assigned to a particular printer, is it possible to
write a macro for this and also to have the macro
automatically run when the file is opened?

Any help would be greatly appreciated
Thanks
Gordon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro to assign a printer to a workbook

Gordon,

You can use VBA to change the name of the ActivePrinter.

Private Sub Workbook_Open()
Application ActivePrinter:="Canon Bubble-Jet BJC-4300 on LPT1:"
End Sub

the default printer remains the same. If you want to change this, check out
this article

http://support.microsoft.com/default...b;en-us;266767
HOWTO: Set Which Printer Is the System Default Printer

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Forbes" wrote in message
...
Hi there,

I have a various workbooks that when I open I would like
to be assigned to a particular printer, is it possible to
write a macro for this and also to have the macro
automatically run when the file is opened?

Any help would be greatly appreciated
Thanks
Gordon



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to assign a printer to a workbook

Hi Bob,

thanks for the reply, I've tried the code you suggested
but it doesn't seem to change from my default printer to
the one I want to specify. Any further suggestions??

Thanks
Gordon


-----Original Message-----
Gordon,

You can use VBA to change the name of the ActivePrinter.

Private Sub Workbook_Open()
Application ActivePrinter:="Canon Bubble-Jet BJC-4300

on LPT1:"
End Sub

the default printer remains the same. If you want to

change this, check out
this article

http://support.microsoft.com/default.aspx?scid=kb;en-

us;266767
HOWTO: Set Which Printer Is the System Default Printer

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Forbes"

wrote in message
...
Hi there,

I have a various workbooks that when I open I would like
to be assigned to a particular printer, is it possible

to
write a macro for this and also to have the macro
automatically run when the file is opened?

Any help would be greatly appreciated
Thanks
Gordon



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro to assign a printer to a workbook

Gordon,

Sorry, I slipped in a syntax error. Try this instead

Private Sub Workbook_Open()
Application.ActivePrinter = "Canon Bubble-Jet BJC-4300 on LPT1:"
End Sub

Also, make sure that you get the printer name right. You can find it by
setting that printer, and then going into the immediate window in VBE and
typing ?Application.ActivePrinter

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Forbes" wrote in message
...
Hi Bob,

thanks for the reply, I've tried the code you suggested
but it doesn't seem to change from my default printer to
the one I want to specify. Any further suggestions??

Thanks
Gordon


-----Original Message-----
Gordon,

You can use VBA to change the name of the ActivePrinter.

Private Sub Workbook_Open()
Application ActivePrinter:="Canon Bubble-Jet BJC-4300

on LPT1:"
End Sub

the default printer remains the same. If you want to

change this, check out
this article

http://support.microsoft.com/default.aspx?scid=kb;en-

us;266767
HOWTO: Set Which Printer Is the System Default Printer

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Forbes"

wrote in message
...
Hi there,

I have a various workbooks that when I open I would like
to be assigned to a particular printer, is it possible

to
write a macro for this and also to have the macro
automatically run when the file is opened?

Any help would be greatly appreciated
Thanks
Gordon



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to assign a printer to a workbook

Thanks again for the prompt reply Bob.

The code now works fine although I have to step into it
and run it before the printer changes. Am I right in
thinking I need to do this all the time or should it
actually update when the file is opened? Or can I set up a
button to run this.

Many thnaks for all your help on this.
Regards
Gordon

-----Original Message-----
Gordon,

Sorry, I slipped in a syntax error. Try this instead

Private Sub Workbook_Open()
Application.ActivePrinter = "Canon Bubble-Jet BJC-4300

on LPT1:"
End Sub

Also, make sure that you get the printer name right. You

can find it by
setting that printer, and then going into the immediate

window in VBE and
typing ?Application.ActivePrinter

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Forbes"

wrote in message
...
Hi Bob,

thanks for the reply, I've tried the code you suggested
but it doesn't seem to change from my default printer to
the one I want to specify. Any further suggestions??

Thanks
Gordon




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro to assign a printer to a workbook

Gordon,

If you put the code in the ThisWorkbook code module, it will automatically
run when you open the workbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Forbes" wrote in message
...
Thanks again for the prompt reply Bob.

The code now works fine although I have to step into it
and run it before the printer changes. Am I right in
thinking I need to do this all the time or should it
actually update when the file is opened? Or can I set up a
button to run this.

Many thnaks for all your help on this.
Regards
Gordon

-----Original Message-----
Gordon,

Sorry, I slipped in a syntax error. Try this instead

Private Sub Workbook_Open()
Application.ActivePrinter = "Canon Bubble-Jet BJC-4300

on LPT1:"
End Sub

Also, make sure that you get the printer name right. You

can find it by
setting that printer, and then going into the immediate

window in VBE and
typing ?Application.ActivePrinter

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Forbes"

wrote in message
...
Hi Bob,

thanks for the reply, I've tried the code you suggested
but it doesn't seem to change from my default printer to
the one I want to specify. Any further suggestions??

Thanks
Gordon




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
setting the default printer for this workbook only mikecoxffbb Excel Worksheet Functions 1 October 25th 08 01:47 AM
Copy printer setup to new sheet in workbook dougforester Excel Discussion (Misc queries) 1 October 9th 06 09:11 AM
Assign macro name to menu command w/o using workbook name Blight_Pete Excel Discussion (Misc queries) 0 August 3rd 06 10:48 PM
Printing all worksheets in a workbook using a duplex printer dott Excel Discussion (Misc queries) 1 November 30th 05 10:20 PM
Is there a way to assign a specific printer to different sheets i. Stage Lamp Excel Worksheet Functions 0 April 6th 05 02:39 AM


All times are GMT +1. The time now is 12:16 PM.

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

About Us

"It's about Microsoft Excel"