Hi! This is my first time posting here although I've used a several examples to help me write basic macros.
I am completed stumped on a project that I thought would be fairly easy. I have an excel file that contains a worksheet for each site (location) that was included in a survey. I found the code below that allows me to print each worksheet and save it as a pdf with the worksheet name. What I can't figure out is how to append two worksheets to each pdf set which are basically cover pages. The first of these pages needs to have the value located in cell B1 of each worksheet into cell A7. The second cover page remains the same for all worksheets.
I'm pretty new to writing macros so I think I'm in over my head on this one. I thought I could simply add line to copy the cover pages but those end up opening in separate files from the worksheets.
Thanks for any direction you can give me!
I am completed stumped on a project that I thought would be fairly easy. I have an excel file that contains a worksheet for each site (location) that was included in a survey. I found the code below that allows me to print each worksheet and save it as a pdf with the worksheet name. What I can't figure out is how to append two worksheets to each pdf set which are basically cover pages. The first of these pages needs to have the value located in cell B1 of each worksheet into cell A7. The second cover page remains the same for all worksheets.
Code:
Option Explicit
Sub Print_PDFWorks()
Dim Awb As Workbook
Dim Snr As Integer
Dim ws As Worksheet
Set Awb = ActiveWorkbook
For Each ws In Awb.Sheets
If Not ws.Name = "Sheet1" Then
'Sheets(ws.Name).Copy
Awb.Sheets(ws.Name).Copy
'Sheets(ws.Name).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Awb.Path & "\" & Awb.Sheets(ws.Name).Name & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
ActiveWindow.Close False
End If
Next ws
End Sub
I'm pretty new to writing macros so I think I'm in over my head on this one. I thought I could simply add line to copy the cover pages but those end up opening in separate files from the worksheets.
Thanks for any direction you can give me!