This forum has been invaluable to me, thanks for all of the past help and any that you can give with this issue.
My problem relates to PDF files. I use PDF's for a slide presentation of data from a variety of worksheets. Originally I modified some PDF software from Dominic (I think) from back in 2009 which required Adobe Acrobat too. That was a little pricey for the group that was using the software, so I found some code by kenneth Hobson, which used some of Excel's newer features to do the same thing.
Here is Kenneth Hobson's code:
I will admit, OO Methods are not my strong point. When I try and figure them out I get lost in the terminology and seemingly endless links.
What I'm trying to do is build a PDF file which will contain the PDF representation of a worksheet, which is modified some 30 to 50 times. I can produce the 30 to 50 pdf's as separate pdf's but I can't seem to get them to all reside in one file. I just lost I'm afraid.
My problem relates to PDF files. I use PDF's for a slide presentation of data from a variety of worksheets. Originally I modified some PDF software from Dominic (I think) from back in 2009 which required Adobe Acrobat too. That was a little pricey for the group that was using the software, so I found some code by kenneth Hobson, which used some of Excel's newer features to do the same thing.
Here is Kenneth Hobson's code:
Code:
Sub cPDFPrintAll() cPublishAllToPDF Worksheets(Array("Record 1", "Record 2"))
Worksheets("Record 2").Select
End Sub
Sub cPDFPrint1()
cPublishAllToPDF Sheets(Array("Record 1"))
Worksheets("Record 1").Select
End Sub
Sub cPDFPrint2()
cPublishAllToPDF Sheets(Array("Record 2"))
Worksheets("Record 2").Select
End Sub
Sub cPublishAllToPDF(o As Object)
Dim fn As String
fn = ThisWorkbook.Path & "\" & cGetBaseName(ThisWorkbook.Name) & ".pdf"
o.Select
cPublishToPDF fn, ActiveSheet
Range("A1").Select
End Sub
Sub cPublishToPDF(fName As String, o As Object)
Dim rc As Variant
rc = Application.GetSaveAsFilename(fName, "PDF (*.pdf), *.pdf", 1, "Publish to PDF")
If rc = "" Or rc = False Then Exit Sub
o.ExportAsFixedFormat Type:=xlTypePDF, Filename:=rc _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
End Sub
Function cGetBaseName(Filespec As String)
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
GetBaseName = FSO.GetBaseName(Filespec)
End Function
I will admit, OO Methods are not my strong point. When I try and figure them out I get lost in the terminology and seemingly endless links.
What I'm trying to do is build a PDF file which will contain the PDF representation of a worksheet, which is modified some 30 to 50 times. I can produce the 30 to 50 pdf's as separate pdf's but I can't seem to get them to all reside in one file. I just lost I'm afraid.