VBA and .ExportAsFixedFormat Type:=xlTypePDF... locks system

lgoolsby

New Member
Joined
Oct 20, 2014
Messages
3
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.

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
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Looks correct and mine works with that same export code.
Are ;you in an older XL?
Is PDF installed?
 
Upvote 0
Using Excel 2010 SP2. I am able to SAVE AS PDF without a problem. Actually created this script by recording a macro.
 
Upvote 0
So after doing more test, it appears this is happening when the sheet it opens to is a CHART. Works fine for normal sheets, just not when it is a chart. Any ideas around this?
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,930
Members
452,367
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top