View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Mark is offline
external usenet poster
 
Posts: 989
Default Printing to Acrobat - Possible to use VBA to program PDF file name

I have a Home sheet that has a series of names

Example: A11 = c:\PDFFiles\Sheet1.pdf
A12 = c:\PDFFiles\Sheet2.pdf


You can use formulas for create names.

I have the vba sub linked to a button on Home Sheet.

Sub CreatePFF()

Sheets("Sheet1").Select
Range("a1").Select

Dim PDFFilename As String

Let PDFFilename = Sheets("Home").Range("a11")
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=PDFFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False

Let PDFFilename = Sheets("Home").Range("a12")
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=PDFFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False

Range("a1").Select

Sheets("Home").Select
Range("b5").Select

End Sub

"Tom Joseph" wrote:

I would like to automate creation of a series of PDFs. Each from a print
range on a different Excel sheet.

I would like the PDF file names to be taken from a series of cells in Excel.
eg

PDF 1 would be called "20090129_ED-IPSTAT-ONC.pdf". This string would be
stored in Cell A1.

PDF 2 would be called "20090129_PerformanceSummary.pdf". This string would
be stored in Cell A2.

and so on.


Any help would be greatly appreciated.