Help with Printing Userforms
I don't have a guess why things are going wrong--you are positive that the users
are changing printers, right?
But after you display the dialog, you could check the name of the printer and
see it's the bad one. If it is, then give a warning and don't print.
But this doesn't really solve your problem.
leerem wrote:
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
--
Dave Peterson
|