Help with print to PDF.

harryreece100

New Member
Joined
Dec 8, 2014
Messages
7
The following macro. Is throwing an error. It is run time error '-2147024773 (8007007b)'.

This page describes how to use the Export fixed format command in excel 2007. I am using Excel 2013. It mentions and add in that is required. I do not have it in excel 2013 but i cannot find the PDF add in for my version of excel.

https://msdn.microsoft.com/en-us/library/bb238907(office.12).aspx



Sub createPDFfiles()


Dim ws As Worksheet
Dim Fname As String
For Each ws In ActiveWorkbook.Worksheets
'On Error Resume Next 'Continue if an error occurs




Fname = " T:\Data Analytics\Reports In-Progress\Allocation\2015\PDFTest\" & ws.Name



ws.ExportAsFixedFormat
Type:=xlTypePDF, _
Filename:=Fname, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

Next ws
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Did the code compile on your computer? It did not on mine. It seems you left out an underscore after ws.ExportAsFixedFormat. Once I added an underscore, it ran fine.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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