LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro for all Excel Workbooks to print to PDF

I found the following macro which prints all selected sheets in an Excel workbook into multiple PDFs and names them the Excel Worksheet name. The first test I did it worked perfectly and saved the PDFs in the same folder that the Excel workbook was in, which was a folder on my desktop. I then put the macro in a personal.xls in C:\ProgramFiles\MicrosoftOffice\OFFICE12\XLStart and tried a different Excel workbook in a different location. The macro was viewable and allowed me to run it, however, it doesn't appear to have saved the PDFs. Can someone tell me what I need to change in my code?

Sub Macro1()
Dim N As Long
Dim fileString As String
Dim cellValue As String

With ActiveWindow.SelectedSheets
For N = 1 To .Count
Sheets(.Item(N).Name).Select
cellValue = Trim(Sheets(.Item(N).Name).Range("A1").Value)
fileString = .Item(N).Name & cellValue & ".pdf"
Sheets(.Item(N).Name).ExportAsFixedFormat Type:=xlTypePDF, Filename:=fileString
Next N
End With

End Sub
 
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
MACRO TO COUNT ALL OPEN WORKBOOKS and print JOSEPH WEBER Excel Programming 1 May 11th 10 07:05 PM
Open many workbooks in Excel & print one page Darla Excel Discussion (Misc queries) 5 May 23rd 06 07:14 PM
I cannot seem to print certain workbooks from Excel 2003 C Goebel Excel Discussion (Misc queries) 4 December 19th 05 09:18 PM
can't print what i want in excel shared workbooks office 2000 professional Excel Programming 0 November 16th 05 09:23 PM
Why does macro speed slow after Excel Print or Print Preview? Larry A[_3_] Excel Programming 6 May 16th 05 11:22 AM


All times are GMT +1. The time now is 05:46 AM.

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

About Us

"It's about Microsoft Excel"