Hi, I've got some code which previously worked - ie creating a PDF of a worksheet, then saving the PDF file in the same folder as the worksheet.
However, it has stopped showing the PDF files that it creates.
Does anyone know why this would happen?
However, it has stopped showing the PDF files that it creates.
Does anyone know why this would happen?
VBA Code:
Sub Save_PDF()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationAutomatic
Dim wb As Workbook
Dim sh As Worksheet
Dim filename_user As Variant
Dim i As Long
Dim c As Long
Dim ShAr() As String
Set wb = ThisWorkbook
Set sh = wb.Sheets("ORIGINAL PAGE")
sh.PageSetup.PrintArea = "A1:M100"
sh.PageSetup.Orientation = xlPortrait
On Error GoTo Err
'ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & Format(Now(), "yymmdd_hhnnss") & "_Auto Contract US Customer View"
filename_user = VBA.InputBox("Enter the file name")
'''Sheets(ShAr()).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & filename_user
MsgBox "Document saved as: " & vbCrLf & filename_user
sh.Select
sh.Range("A1").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Exit Sub
Err:
MsgBox "Document not saved / Cancelled" & vbCrLf & _
"Also, please close if the document is already opened and then try again."
sh.Select
sh.Range("A1").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Exit Sub
sh.Select
sh.Range("A1").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
End Sub