Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Using VBA to intercept PDF's Save file dialog box

I would like to use VBA to automatically store a PDF file with a internal
name into a specified directory without having to use the PDF "Save" button
to save a file into a directory. Any helpful ideas???????


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Using VBA to intercept PDF's Save file dialog box

Not quite sure what you mean. Do you want to copy an existing PDF file into
another location? Or move it?

If you mean an open but unsaved/unnamed PDF file, I don't think you can save
it using VBA.

--

Vasant




"Bill Agee" wrote in message
k.net...
I would like to use VBA to automatically store a PDF file with a internal
name into a specified directory without having to use the PDF "Save"

button
to save a file into a directory. Any helpful ideas???????




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Using VBA to intercept PDF's Save file dialog box

Hi Bill

I'm assuming you have the Acrobat writer as well as the reader and you want
to print an Excel workbook into a "pdf" format.

Firstly, go to the site below, download the Ghostscript and GSView files and
follow the general setup procedures outlined on that site.
http://www.rcis.co.za/dale/info/pdfguide.htm

Once you have done that, you can convert an Excel file to a pdf file with a
specified name and path using code something like the following.....


Sub PrintWorkbookAsPDF()
'Need to set a reference to Acrobat Distiller
Dim PSFileName As String
Dim PDFFileName As String
Dim myPDF As PdfDistiller
Dim x As String, y As String
Dim iprinter As String
iprinter = Application.ActivePrinter
Application.ActivePrinter = "Acrobat Distiller on Ne02:"

'Set the name and path of the pdf file
If ActiveWorkbook.Path = "" Then
x = CreateObject("WScript.Shell").SpecialFolders("Desk top") & "\"
y = ActiveWorkbook.Name
Else
x = ActiveWorkbook.Path & "\"
y = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
End If

' Print the Excel workbook to the postscript file
PSFileName = x & y & ".ps"
PDFFileName = x & y & ".pdf"
ActiveWorkbook.PrintOut , prtofilename:=PSFileName

' Convert the postscript file to .pdf
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

'Kill the postscript file
Kill (PSFileName)

'Reset original pinter
Application.ActivePrinter = iprinter

'Open the pdf file - amend path as necessary
'If text wraps, the following is one line
Shell "C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe " +
PDFFileName, 1

End Sub



--
XL2002
Regards

William



"Bill Agee" wrote in message
k.net...
| I would like to use VBA to automatically store a PDF file with a internal
| name into a specified directory without having to use the PDF "Save"
button
| to save a file into a directory. Any helpful ideas???????
|
|



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
Save file dialog box in Excel falcios Excel Discussion (Misc queries) 4 February 12th 07 08:29 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
How do you disable save file dialog? someone Setting up and Configuration of Excel 2 February 13th 05 12:02 AM
Getting "Save as PDF File" Dialog at end of printing to PDF using PDFwriter Chuck Reed Excel Programming 4 May 13th 04 12:01 PM
Close file without Save Changes dialog box flumpf Excel Programming 1 October 24th 03 02:38 AM


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