I had the macro below which previously would go to the folder and open each workbook and save it as a PDF; however, it seems now it opens the file and stops running the macro.
Path is defined and works, the issue is after it run the line for Workbooks.Open it stops there.
Sub PrintFolderToPDF()
'Functions
Dim wbktoExport As Workbook
Dim strSourceExcelLocation As String
DefineVars
TurnOffFunctions
Application.DisplayAlerts = False
On Error GoTo FireExit
strSourceExcelLocation = Path & ""
'Search all Excel files in the directory with .xlsx extensions
FileName = Dir(Path & "" & "*.xlsx")
Do While Len(FileName) > 0
'Open the workbook
'This is last line before it stops without an error
Set wbktoExport = Workbooks.Open(Path & "" & FileName, UpdateLinks:=0, ReadOnly:=False) '
'Export all sheets as single PDF
Export_Excel_as_PDF (wbktoExport)
'Get next workbook
FileName = Dir
'Close Excel workbook without making changes
wbktoExport.Close False
Loop
FireExit:
TurnOnFunctions
Application.DisplayAlerts = True
End Sub
1