03aviator
New Member
- Joined
- May 31, 2011
- Messages
- 17
I have a large workbook that I print about 11 print ranges into PDF files and I want to give a name to the saved PDF files based on a different cell in the main workbook. When running individual macros for each print range everything works fine, but when trying to run all as one macro only the first file is created and the others aren't. I am using Windows XP Professional SP 3 with MS Office Excel 2007 with Adobe Acrobat 9 Standard Edition.
This is my code:
Sub PrintPDFPage1()
'
' PrintPDFPage1 Macro
'
'
Application.Goto Reference:="Print_Page_1"
Filename = ActiveSheet.Range("A100").Value
SendKeys Filename & "{ENTER}", False
ActiveSheet.PageSetup.PrintArea = "$A$1:$O$74"
Application.ActivePrinter = "Adobe PDF on Ne01:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF on Ne01:"",,TRUE,,FALSE)"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 2
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'
' Sheets("LBPS Bucket Report").Select
Range("A1").Select '
End Sub
each print macro is the same, just the cell refernce for the filename changes.
Any recommendations? I am just learning how to use the programming functions of MS Excel.
Thanks
This is my code:
Sub PrintPDFPage1()
'
' PrintPDFPage1 Macro
'
'
Application.Goto Reference:="Print_Page_1"
Filename = ActiveSheet.Range("A100").Value
SendKeys Filename & "{ENTER}", False
ActiveSheet.PageSetup.PrintArea = "$A$1:$O$74"
Application.ActivePrinter = "Adobe PDF on Ne01:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF on Ne01:"",,TRUE,,FALSE)"
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 2
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'
' Sheets("LBPS Bucket Report").Select
Range("A1").Select '
End Sub
each print macro is the same, just the cell refernce for the filename changes.
Any recommendations? I am just learning how to use the programming functions of MS Excel.
Thanks