Home

ExportasfixedFormat office 2010

Highlighted
jimrawcliffe
Occasional Visitor

I have the following macro which produces the desired effect but then errors

 

Any help appreciated

 

'This code will save each worsheet as a separate PDF
Sub SaveWorkshetAsPDF()
Application.ScreenUpdating = False

Dim ws As Worksheet
Dim path As String
Dim fol As String
Dim name As String
Dim concat As String
Dim fdObj As Object


path = ActiveWorkbook.path
fol = "\PDFs\"
Set fdObj = CreateObject("Scripting.FileSystemObject")
If fdObj.FolderExists(path & fol) Then
MsgBox "Found it", vbInformation
Else
fdObj.createfolder (path & fol)
MsgBox "folder created", vbInformation
End If

For Each ws In Worksheets

name = ws.name
MsgBox name

concat = path & fol & name
MsgBox concat
With ws.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = False
.PaperSize = xlPaperA3
End With
ws.ExportAsFixedFormat xlTypePDF, fileName:=concat, OpenAfterPublish:=True

Next ws

Application.ScreenUpdating = True

End Sub

 

Related Conversations
Is it possible for Edge to play HEVC (H265) MKV files ?
HotCakeX in Discussions on
2 Replies
TLS 1.2 and Exchange 2010 Hybrid
Navishkar Sadheo in Exchange on
0 Replies
Office Deployment: Pin to START Menu
Brian LeFlem in Microsoft Intune on
1 Replies
Exchange On-Premise UM w/ Exchange Online Mailbox
Jamie BRANDWOOD in Exchange on
0 Replies
I can't open a Macro enable excel and word file
Roxanne26 in Office 365 on
2 Replies
can't export files in sharepoint 2010
lina2020 in SharePoint on
1 Replies