ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 6,094
- Office Version
- 2024
- Platform
- Windows
I am using the following code.
When looking at the page on the pc in 4 various cells the font is Black so the user can see its value.
However this isnt to be seen on the printed sheet hence why i would like the font to be white.
I added what i thought was correct & ive shown you below BUT it still got printed in Black.
I get no errors when i click the command button.
What did i do wrong please advise
When looking at the page on the pc in 4 various cells the font is Black so the user can see its value.
However this isnt to be seen on the printed sheet hence why i would like the font to be white.
I added what i thought was correct & ive shown you below BUT it still got printed in Black.
I get no errors when i click the command button.
What did i do wrong please advise
Rich (BB code):
Private Sub PurchasedKey_Click()
Dim sPath As String
Dim strFileName As String
Dim sh As Worksheet
Dim wb As Workbook
With ActiveSheet
If .Range("Q1") = "" Then
MsgBox "NO CODE SHOWN TO GENERATE PDF", vbCritical, "NO CODE ON SHEET TO CREATE PDF"
Exit Sub
End If
If .Range("N1") = "M" Then
strFileName = "C:\Users\there\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & " (SLS).pdf"
Else
strFileName = "C:\Users\there\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & ".pdf"
End If
If Dir(strFileName) = "" Then
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
MsgBox "PDF FILE HAS NOW BEEN SAVED", vbInformation + vbOKOnly, "SAVED PDF FILE MESSAGE"
With ActiveSheet
ActiveWindow.SelectedSheets.PrintOut copies:=1 ' ALTERNATE THE COMMENT OUT WITH PRINTING & THE MSGBOX BELOW
'MsgBox "PRINTING CURRENTLY COMMENTED OUT IN THE CODE", vbInformation, "PRINTING OFF WHILST TESTING CODE"
.Range("E9").Font.Color = vbWhite
.Range("E13").Font.Color = vbWhite
.Range("E17").Font.Color = vbWhite
.Range("E21").Font.Color = vbWhite
Unload PrinterForm
Set wb = Application.Workbooks.Open("C:\Users\there\Desktop\REMOTES ETC\DR\DR.xlsm")
Worksheets("POSTAGE").Activate
Call DISCOHYPERLINK
End With
Else
'IF FILE IS PRESENT DO NOT ALLOW FILE TO BE OVERWRITTEN & TO SHOW MSGBOX
MsgBox "CUSTOMERS FILE HAS ALLREADY BEEN SAVED", vbCritical + vbOKOnly, "FILE ALLREADY SAVED MESSAGE"
Dim strFolder As String
strFolder = "C:\Users\there\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\"
ActiveWorkbook.FollowHyperlink Address:=strFolder, NewWindow:=True
Unload PrinterForm
End If
Exit Sub
End With
End Sub