#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Macro

I need to create a macro in excel that prints out multiple reports in
pdf format. Is there a way to hardcode the pdf file name so the save
as message box doen't appear??

Thanks


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Excel Macro

The following will save the file as you specify, not sure about the .pdf
format your require, but the message box will be suppressed

Application.DisplayAlerts = False
Workbook.SaveAs Filename:="path\filename"
Application.DisplayAlerts = True

"bstruchen" wrote in message
...
I need to create a macro in excel that prints out multiple reports in
pdf format. Is there a way to hardcode the pdf file name so the save
as message box doen't appear??

Thanks


---
Message posted from http://www.ExcelForum.com/





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Macro

Thanks for your help.

I wrote a macro see below. The problem is it only prints in black and
white and I need color.


Any ideas !!!

Sub Brian()

'
' PrintPDF2 Macro
' Macro recorded 12/16/2003 by bjstruch
'
Dim PSFileName As String
Dim PDFFileName As String
Dim DistillerCall As String

Dim ReturnValue As Variant

'Local folder to hold PSFileName and PDFFileName
PSFileName = "C:\temp\Brian.PS"

PDFFileName = "C:\temp\Brian.PDF"

'If exist then delete
If Dir(PSFileName) < "" Then Kill (PSFileName)

If Dir(PDFFileName) < "" Then Kill (PDFFileName)


SendKeys PSFileName & "{ENTER}", False


'This is where you set the active area

Application.Goto Reference:="TBLBDGR"

ActiveSheet.PageSetup.PrintArea = "$M$75:$S$131"

ActiveSheet.PrintOut , printtofile:=True


'Add " " to file names [Chr(34) = "]
PSFileName = Chr(34) & PSFileName & Chr(34)

PDFFileName = Chr(34) & PDFFileName & Chr(34)


'Call .exe to writ PS file to PDF format
DistillerCall = "C:\Program Files\Adobe\Acrobat
5.0\Distillr\Acrodist.exe" & _
" /n /q /c" & PDFFileName & " " & PSFileName

'" /n /q /o"

'If the application doesn't open correctly let us know about it
ReturnValue = Shell(DistillerCall, vbNormalFocus)

If ReturnValue = 0 Then MsgBox "Creation of" & PDFFileName & "failed."

'
End Sub


---
Message posted from http://www.ExcelForum.com/

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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
passing variables from an excel macro to a powerpoint macro jake Excel Programming 1 December 11th 03 02:36 AM


All times are GMT +1. The time now is 06:53 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"