Senin, 01 Oktober 2012

RE: [ExcelVBA] Selective PDF creation

 

Hi Steve

Try this

Sub Save2PDF()
'
' Save2PDF Macro
'
Dim WbP As String
Dim ProjectName As String
WbP = ActiveWorkbook.Path
ProjectName = Cells(5, 6)

Sheets(Array(Sheets(1).Name, Sheets(2).Name, _
Sheets(3).Name, Sheets(4).Name, Sheets(5).Name, _
Sheets(6).Name, Sheets(7).Name)).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ProjectName &
"_Report", Quality:=xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End Sub

Best Regards
David Grugeon
Excel VBA Group Moderator

-----Original Message-----
From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com] On Behalf
Of steven.eckley
Sent: Tuesday, 2 October 2012 1:45 AM
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Selective PDF creation

I currently run this macro activated by a button to save my workbook as a
PDF file. The Macro works however I'd like to have only the first 7
worksheets included in the PDF creation all the other once should be
ignored.

The names of the worksheet tabs are always the same however other worksheets
change position into the first 7 and then be renamed to the standard name.
the name order is normally Summary, Cost1,Cost2,Cost3, Des1,Des2,Des3 and
ver.

In the save as fumction you have a option for selection however i do not
know how to replicate this in VBA to illiminate the human interaction

Sub Save2PDF()
'
' Save2PDF Macro
'
Dim WbP As String
Dim ProjectName As String
WbP = ActiveWorkbook.Path
ProjectName = Cells(5, 6)


'
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF,
Filename:=ProjectName & "_Report", Quality:=xlQualityStandard,
IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True


------------------------------------

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
here: http://www.mousetrax.com/techtrax to enter the ezine, then search the
ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------Yahoo! Groups Links

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar