Morning,
I was hoping that somebody can help me adapt the following code where a userform is being printed.
My problem is it works fine, choosing a printer etc. The problem is that I do not want this code to change the users default printer automatically to the preferred printer for this specific printing job. Example, my computers default printer is an HP Laserjet always, but when I click to print the userform I choose let’s say print to pdf. It does this perfectly, but later I want to print some other random document then my default printer on my comptures has changed to the pdf printer. I want to prevent this when choosing a printer for the userform. I hope I am making sense.
Private Sub CommandButton3_Click()Please Login or Register to view this content.
Dim fileOK As Boolean
Dim sPrinter As String
With Application
sPrinter = .ActivePrinter
fileOK = .Dialogs(xlDialogPrinterSetup).Show
End With
If fileOK = True Then
ChangeDefaultPrinter (Application.ActivePrinter)
Project_Dashboard.PrintForm
ChangeDefaultPrinter (sPrinter)
End If
End Sub
Public Sub ChangeDefaultPrinter(pName As String)
Set oWord = CreateObject("Word.Application")
oWord.WordBasic.FilePrintSetup Printer:=pName, DoNotSetAsSysDefault:=0
Set oWord = Nothing
End SubAnother question: If I want to build in a commandbutton to save the userform to file as an image, how I would do this in vba code so I can select the file location, change the file name etc. That normal “save as” pop-up box.Please Login or Register to view this content.
Thank you in advance!!!!
Bookmarks