LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VB Code for saving PDF Print File

The following is my code to print individual worksheets to .pdf file. How do
I change the following code to use file name as coded instead of the SAVE AS
box popping up? Thanks.

Sheets(Array("KAW Financial Summary", "Total Impact", _
"Gas Impact", "OIL Impact", "NGL Impact", "CO2 Impact")).Select
Application.ActivePrinter = "CutePDF Writer on CPW2:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"CutePDF Writer on CPW2:", Collate:=True

Dim myRange As Range
Set myRange = Worksheets("_").Range("a1")
stryearmo = Application.WorksheetFunction.Text(myRange, "yyyy-mm")
strdiryr = Application.WorksheetFunction.Text(myRange, "yyyy")
strmo = Application.WorksheetFunction.Text(myRange, "mm")

strfullfile = "U:\QEP\Revenue\Revenue_Estimates\Closing-" & strdiryr &
"\" & strdiryr & "_" & strmo & "\" & stryearmo & "EstimateImpact.pdf"
If Dir(strfullfile, vbNormal) < "" Then
Kill strfullfile
End If

ActiveWorkbook.SaveAs Filename:=strfullfile, _
CreateBackup:=False
 
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
Ranges, adding a column to a named print range then saving the file [email protected] Excel Programming 1 April 27th 06 01:42 AM
Continue executing code while saving file Henrich Excel Programming 1 March 29th 06 12:33 PM
Saving print area as file TexMas Excel Discussion (Misc queries) 2 March 31st 05 07:33 PM
VBA Saving code causes SAVED file to be corrupt Raymond Allan Excel Programming 0 June 24th 04 04:50 PM
Code for saving as a .prn file Jim Rech Excel Programming 0 August 5th 03 01:38 PM


All times are GMT +1. The time now is 04:05 PM.

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

About Us

"It's about Microsoft Excel"