LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default VBA macro creating pdf

Hi Brad

You are welcome

I also add a example to the pdf page
http://www.rondebruin.nl/pdf.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Brad" wrote in message ...
Thank you!!
--
Wag more, bark less


"Ron de Bruin" wrote:

Hi Brad

Use this then in the array

Sheets(Array(shtCover.Name, shtValue.Name, shtFinal.Name)).Copy

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Brad" wrote in message ...
Yes!!
--
Wag more, bark less


"Ron de Bruin" wrote:

Hi Brad

Is shtCover the code name of the sheet in the VBE do you mean that ?

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Brad" wrote in message ...
Ron
Restating my very first question - how do I change -

Sheets(Array("Sheet1", "Sheet3")).Copy
to (the below syntax is probably wrong)
Sheets(Array("shtCover", "shtValue", "shtFinal")).Copy

Where I control the sheet1's name as shtCover (in VBE)
and I control the sheet3 's name as shtFinal (in VBE)

"Ron de Bruin" wrote:

Do a copy of the sheets first and then use the activeworkbook macro

Try this
Enter your sheet names in this code line
Sheets(Array("Sheet1", "Sheet3")).Copy


Sub RDB_PDF_Workbook()
Dim FilenameStr As String
Dim wb As Workbook

'create a new workbook with the sheets you want
Sheets(Array("Sheet1", "Sheet3")).Copy
Set wb = ActiveWorkbook

If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then

FilenameStr = Application.DefaultFilePath & "\" & _
Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"

wb.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
MsgBox "You can find the PDF file here : " & FilenameStr

'close the file without saving
wb.Close False

Else
MsgBox "PDF add-in Not Installed"
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Brad" wrote in message ...
Ron,

If I'm reading your code correctly -
...ActiveWorkbook - does the entire workbook

...ActiveSheet - does one sheet

..ActiveSheet_Pages - does first X pages (1 to 2 in your example) from one
sheet

What I'm lookg for is one that will print only three sheets (or tabs) from a
workbook. Which is between your first and second macro...

I appreciate your help!
--
Wag more, bark less


"Ron de Bruin" wrote:

Hi Brad

See if you find your answer on this page
http://www.rondebruin.nl/pdf.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Brad" wrote in message ...
The below works but I have two questions.

Question 1. How do I change this to access the sheets name?
Question 2. Can this code be condensed and still provide the same result?

Using Excel 2007....

Sub Updateforms()
Sheets(Array("PageFirst", "AAlt", "PageLast")).Select
Sheets("PageFirst").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"S:\PUBLIC\FundPerf\Performance flier\AA0508.pdf",
Quality:=xlQualityStandard _
, IncludeDocProperties:=True, IgnorePrintAreas:=False,
OpenAfterPublish:=False
End Sub


--
Wag more, bark less






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a New Macro SharonJo Excel Discussion (Misc queries) 1 April 4th 08 01:27 AM
Creating Macro Chey Excel Discussion (Misc queries) 1 January 18th 07 06:21 PM
Macro Creating Duster142 New Users to Excel 2 October 7th 05 01:50 AM
Creating a macro Gene Goldenfeld New Users to Excel 10 May 5th 05 04:28 PM
Need Help Creating A Macro LJ Owen Excel Worksheet Functions 1 March 2nd 05 01:52 PM


All times are GMT +1. The time now is 03:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"