Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Script to Print several named ranges to PDF with cell-defined filenames
I'd like to name several ranges (or define several custom views) an have the VB script print them to PDF using Adobe Acrobat Pro. I thin this can be done by creating a worksheet with a column containing th name of the range/custom view and another column with the desire filename. The sheet would have a "Print" button that triggers th macro. I found a similar script on on another pos (http://tinyurl.com/zjwkx, but don't know how to tweak it for what need. Sub PrintReports() Dim NumberPages, PageNumber, i As Integer Dim ActiveSh As Worksheet Dim ChooseShNameView As String Dim ShNameView As String Application.ScreenUpdating = False Set ActiveSh = ActiveSheet For Each Cell In Range(Range("a2"), Range("a2").End(xlDown)) ShNameView = ActiveCell.Offset(0, 1).Value PageNumber = ActiveCell.Offset(0, 2).Value Select Case Cell.Value Case 1 Sheets(ShNameView).Select Case 2 Application.Goto Reference:=ShNameView Case 3 ActiveWorkbook.CustomViews(ShNameView).Show ActiveWorkbook.CustomViews End Select With ActiveSheet.PageSetup .CenterFooter = PageNumber .LeftFooter = ActiveWorkbook.FullName & "& A &T &D " End With ActiveWindow.SelectedSheets.PrintOut Copies:=1 Next ActiveSh.Select Application.ScreenUpdating = True End Sub Let me know what you think. Thanks -- jbmessamor ----------------------------------------------------------------------- jbmessamore's Profile: http://www.excelforum.com/member.php...fo&userid=3636 View this thread: http://www.excelforum.com/showthread.php?threadid=56148 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Print all named ranges | Excel Programming | |||
Ranges, adding a column to a named print range then saving the file | Excel Programming | |||
Like 123, allow named ranges, and print named ranges | Excel Discussion (Misc queries) | |||
Macro (Print) - Calling Named Ranges | Excel Discussion (Misc queries) | |||
ADO - recordset - closed excel workbook - know sheet name and cell name but no named ranges defined | Excel Programming |