View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
leerem leerem is offline
external usenet poster
 
Posts: 88
Default Help with Printing Userforms

Hi All,
I'm having diffilculty in Printing my Userforms to a specific
printer.

The Code I've used previously to print sections of a worksheet is as follows:

Sub CmdPrint()
Dim Printb as Boolean

ActiveSheet.PageSetup.PrintArea = "$HG$7:$HM$16"
Printb = Application.Dialogs(xlDialogPrinterSetup).Show
If Printb = True Then ' Print only if OK Button is pressed
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("calculations").Visible = False
ActiveWorkbook.Protect Password:=Passwd

Elseif Printb = False Then ' Cancells Print operation
Sheets("calculations").Visible = False
ActiveWorkbook.Protect Password:=Passwd
End sub

When printing a userform I tried to use the code:
Sub PrintReports1

Dim Printb as Boolean
Printb = Application.Dialogs(xlDialogPrinterSetup).Show
If Printb = True Then
DailyReports1.PrintForm
Elseif Printb = False Then ' Cancells Print operation
ActiveWorkbook.Protect Password:=Passwd
End if

But this seems to send the data to a different Printer than requested, but
it seems to be alway the same one, but this is an old Printer that no longer
exists. I know i can uninstall this printer but this in it'self wouldn't
solve the problem.

Can anyone advise me on where I've gone wrong with the code, I need to use
the xlDialogPrinterSetup due to the end Users PC's having different Printer
Configurations setups.

Regards
Lee