mtagliaferri
Board Regular
- Joined
- Oct 27, 2004
- Messages
- 156
I have a code which works perfectly, I need to refine the UI experience and need to hide the sheets to sheets the code runs on, of course the code wont run, so I thought to make the individual sheet visible to run the code and then hide it again.
I have tried a few variants of the below code (Worksheets / Sheets) I have also placed the code after the "With ShAcceptanceOfResignation" but everything I try gets me knowhere!
What am I doing wrong?
I have tried a few variants of the below code (Worksheets / Sheets) I have also placed the code after the "With ShAcceptanceOfResignation" but everything I try gets me knowhere!
VBA Code:
Sub CreateOpenPDF()
Application.ScreenUpdating = False
Worksheets("ShAcceptanceOfResignation").Visible = True
With ShAcceptanceOfResignation
.ExportAsFixedFormat xlTypePDF, Environ("Userprofile") & "\Documents\" & .Range("B16") & " " & .Range("B17") & " " & _
Format(.Range("M26"), "YYYYMMDD") & " " & .Name & ".pdf", OpenAfterPublish:=True
Worksheets("ShAcceptanceOfResignation").Visible = False
End With
With ShLeaversForm
.ExportAsFixedFormat xlTypePDF, Environ("Userprofile") & "\Documents\" & .Range("D12") & " " & .Range("D13") & " " & _
Format(.Range("E19"), "YYYYMMDD") & " " & .Name & ".pdf", OpenAfterPublish:=True
End With
With ShCompanyPropertyChecklist
.ExportAsFixedFormat xlTypePDF, Environ("Userprofile") & "\Documents\" & .Range("D11") & " " & .Range("D12") & " " & _
Format(.Range("J13"), "YYYYMMDD") & " " & .Name & ".pdf", OpenAfterPublish:=True
End With
Application.ScreenUpdating = True
End Sub
What am I doing wrong?