I am trying to use VBA to Open a workbook, save as PDF and Close workbook. When I run the script it will open the desired Workbook, however it does nothing else and I am unable to do anything in Excel. I then use TaskManager to End the Task so that I can try again. Here is the code I am using. Please note that I am able to do this task manually with out any issues so I know that my Save as PDF works just fine. I need to automate this task as I have many many many workbooks to perform this on monthly. Any help is greatly appreciated.
Sub testsavepdf()
'
' testsavepdf Macro
'
'
ChDir "W:\DPT MEETING REPORTS\Chg & Pymt Comp - Mcubed"
Workbooks.Open Filename:= _
"W:\DPT MEETING REPORTS\Chg & Pymt Comp - Mcubed\ANATOMIC LAB + REFERENCE LAB~format.xlsx"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"W:\DPT MEETING REPORTS\Chg & Pymt Comp - Mcubed\1.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
ActiveWorkbook.Close
End Sub
Thanks,
Lee Goolsby
Code:
Sub testsavepdf()
'
' testsavepdf Macro
'
'
ChDir "W:\DPT MEETING REPORTS\Chg & Pymt Comp - Mcubed"
Workbooks.Open Filename:= _
"W:\DPT MEETING REPORTS\Chg & Pymt Comp - Mcubed\ANATOMIC LAB + REFERENCE LAB~format.xlsx"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"W:\DPT MEETING REPORTS\Chg & Pymt Comp - Mcubed\1.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
ActiveWorkbook.Close
End Sub
Thanks,
Lee Goolsby