Scenario: I am currently writing an excel document with VBA userforms and macros to populate a sheet with data, print it, and repeat the process a number of times.
The user has already input several people's names into several text boxes all named "txtName1" "txtName2" etc.
Printing works fine on my computer where the printer settings have been set to allow color printing by default.
The issue is that I am sending this document to several other offices where the computers tend to have their default setting as black and white (to conserve ink).
Is there something I can do to either 1) have the VBA code tell the printer to override the default and print in color anyway or 2) Have the default printer's settings window pop up (as would normally do if you select "Print" from the task bar) so the user can double check that the settings allow for color before the program prints the documents
The reason why I entered the code
was because it seemed to be relevant, but it turns out it only makes changes to the document and not the printer... so the printers default prints in black and white anyway... basically this code is useless for me.
Many of the forums I read online ask me to type in the printer name... That would be fine for my computer, but as I said, several users are using this and they each have their own default printers. I do not know the names of them.
Is this possible? Please help.
The user has already input several people's names into several text boxes all named "txtName1" "txtName2" etc.
Code:
Dim Name As String
Dim numofpeople As Integer ' ///previously set earlier in the code with no problems (based on counting the number of text boxes that aren't blank)
Dim i As Integer
For i = 1 To numofpeople
Name = Controls("txtName" & i).Value
Sheets("Form").Select
Range("J4").Value = Name ' /// fills in the cell which links to the data on the sheet which will be printed
Select Case cmbTypeofDocument.Value ' /// combo box the user selects to determine what document to print for all the names listed
Case "Type A"
Sheets("AA").Visible = True
Sheets("AA").Select
Case "Type B"
Sheets("BB").Visible = True
Sheets("BB").Select
Case "Type C"
Sheets("CC").Visible = True
Sheets("CC").Select
Case "Type D"
Sheets("DD").Visible = True
Sheets("DD").Select
Case Else
MsgBox "No Document Type Selected. Please try again."
Unload userformDataEntry
End Select
ActiveSheet.PageSetup.BlackAndWhite = False ' /// code I found online while searching
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1
Next i
Sheets("Form").Select
Range("J4").Value = "" ' /// To reset the name to nothing.
Sheets("AA").Visible = False
Sheets("BB").Visible = False
Sheets("CC").Visible = False
Sheets("DD").Visible = False
MsgBox "Finished! Please collect your documents from the printer."
Unload Me
Printing works fine on my computer where the printer settings have been set to allow color printing by default.
The issue is that I am sending this document to several other offices where the computers tend to have their default setting as black and white (to conserve ink).
Is there something I can do to either 1) have the VBA code tell the printer to override the default and print in color anyway or 2) Have the default printer's settings window pop up (as would normally do if you select "Print" from the task bar) so the user can double check that the settings allow for color before the program prints the documents
The reason why I entered the code
Code:
ActiveSheet.PageSetup.BlackAndWhite = False
Many of the forums I read online ask me to type in the printer name... That would be fine for my computer, but as I said, several users are using this and they each have their own default printers. I do not know the names of them.
Is this possible? Please help.
Last edited: