Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Close PDF file without Save prompt

Posted on 2007-07-30
3
Medium Priority
?
2,466 Views
Last Modified: 2012-06-21
I'm using Outlook2000 and Acrobat 7 Pro, I have a VBA script that watches a Outlook Folder for new mail then prints the attachments, either PDF or TIFF.  It uses Acrobat 7 Pro to open and print the attachments, the issue is that Acrobat then prompts to save the file before closing. Is there anyway I can disable this prompt, either from within Adobe Acrobat or from the VBA script?
Below is the print sub from my script.
I've tried the AcroApp.Close call but it doesn't work.

Many thanks!

Sub PrintPDF2(ByVal FileName As String, Optional Copies As Long = 1)
     '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     '++ Prints the PDF files using a command line.
     '++ Written by Masaru Kaji aka Colo
     '++ Syntax
     '++ FileName : Required String expression that specifies a file name
     '++           - may include directory or folder, and drive..
     '++ Copies : Optional Long. The number of copies to print.
     '++          If omitted one copy is printed.
     '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Dim cnt As Long
    Dim myShell
    Set myShell = CreateObject("WScript.Shell")
    Dim Acro As AcroApp
   
    Set Acro = New AcroApp
           
    For cnt = 1 To Copies
         'opens Acrobat and prints file
        'myShell.Run ("""C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe""" & "/t " & FileName)
        myShell.Run ("""C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe""" & "/t " & FileName)
    Next
     'tidy up
   Acro.Exit
End Sub
0
Comment
Question by:Michael Gjernes
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
jdthedj earned 750 total points
ID: 19613342
In the Acrobat type library there is a function to close without saving under CAcroAVDoc interface

function Close(bNoSave: WordBool): WordBool; dispid 6;
0
 

Author Comment

by:Michael Gjernes
ID: 19617692
Thanks for that, it works for PDF documents but not for TIFFs.  I need to be able to print PDF and TIFF, the TIFF still prompts to save before closing where as the PDFs print silently.  Any ideas?
0
 

Author Comment

by:Michael Gjernes
ID: 19617720
I've edited the code of the PrintPDF2...
Sub PrintPDF2(ByVal FileName As String, Optional Copies As Long = 1)
    Dim cnt As Long
    Dim myShell
    Set myShell = CreateObject("WScript.Shell")
    Dim CloseAcrobat As Boolean
    CloseAcrobat = "True"
    Dim CAcro As AcroAVDoc
    Set CAcro = New AcroAVDoc
           
    For cnt = 1 To Copies
         'opens Acrobat and prints file
        myShell.Run ("""C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe""" & "/t " & FileName)
    Next
     'tidy up
    CAcro.Close (CloseAcrobat)
End Sub
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Take a look at these 6 Outlook Email management tools which can augment the working and performance of Microsoft Outlook to give you a more rewarding emailing experience.
I came across an unsolved Outlook issue and here is my solution.
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question