Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print all named ranges Ctech[_139_] Excel Programming 4 May 16th 06 12:08 AM
Ranges, adding a column to a named print range then saving the file [email protected] Excel Programming 1 April 27th 06 01:42 AM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
Macro (Print) - Calling Named Ranges KGlennC Excel Discussion (Misc queries) 1 March 19th 05 09:20 PM
ADO - recordset - closed excel workbook - know sheet name and cell name but no named ranges defined grahamd Excel Programming 1 October 18th 04 06:13 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"