LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Change ActivePrinter in a Add-In

On 3 nov, 10:18, Ludo wrote:
Hi all,

I'm converting a .xls application with a lot of forms & some modules
to a ADD-IN.
The problems i met while converting are most solved by info i found on
this forum, thank you all a lot for it ;).
But, i still have a problem.

I need sometimes to change from printer, depending on a single
criteria.
I use in the .xls file following code:

Application.ActivePrinter = ProductionPrinter

This works fine as long as the 'IsAddIn' property is set to false.
If i set this property to True, then i get a fail message.

How can i change the active printer to another printer in a Add-In?

Thanks in advance.
Regards,
Ludo


Hi all,

I think i found a workaround, by using the same trick as when you want
to add extra sheets into an Add-In.
Simply set the ThisWorkbook.IsAddin = False
After changing your printer, set it back to True.

See example that i use:

'Print
'ProductionPrinter = print on white paper = default printer
'Csgprinter = print on yellow paper (different printer than the
default printer!)
'
'check for printer(CSG)if white or yellow paper needed
Application.ScreenUpdating = False
' set Production printer as active printer & print sheet 'Dagverloop'
ThisWorkbook.IsAddin = False
Application.ActivePrinter = ProductionPrinter
'print to default printer
ThisWorkbook.Sheets("dagverloop").PrintOut
'
For Dummy = 1 To NumberOfUnits
If frmFollowupSheets.Controls("lblserialnumber" &
Dummy).Caption "" Then '
' set CSGPrinter as active printer
If CSG(Dummy) = True Then
Application.ActivePrinter = Csgprinter
Else
' set Production printer as active printer
Application.ActivePrinter = ProductionPrinter
End If
'print active sheet to active printer
ThisWorkbook.Sheets("toestel" & Dummy).PrintOut
ActivePrinter:=Application.ActivePrinter
End If
Next
ThisWorkbook.IsAddin = True

Hope to help someone with it when needed.

Regards,
Ludo
 
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
Change ActivePrinter? Charlotte E[_2_] Excel Programming 15 April 14th 11 06:04 AM
ActivePrinter in Excel changes! GarySmith2 Excel Programming 5 June 27th 06 08:38 PM
Activeprinter ben Excel Programming 4 October 19th 05 02:36 PM
VBA ActivePrinter POM Excel Programming 3 February 23rd 05 10:08 AM
Application.ActivePrinter??? Aldo Miele Excel Programming 1 September 7th 04 12:18 PM


All times are GMT +1. The time now is 05:49 AM.

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"