Results 1 to 4 of 4
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,195

    Closing a PDF Doc VBA

    Hi everyone, is it possible to close a PDF document this is minimized via a combo after update procedure ?? Adobe acrobat reader is what the PDF is open Via code below, I am wanting to be able to close the active PDF document via another procedure ??



    Dim SLOpen, FlowPath, MyItem as String

    Code:
    If Me.cboFolder <> "" Then
    SLOpen = Left(Me.cboViewPDF, 9)
    If IsNull(MyItem = DLookup("Contact", "tblEdit", "[SONumber] = '" & SLOpen & "'")) Then
    FlowPath = "T:\Customer\Customer PDF's\" & Me.cboViewPDF
    Application.FollowHyperlink FlowPath
    Else
    DoCmd.CancelEvent
    End If
    Kind Regards

    Dave

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    AFAIK, can't close a specific file, have to kill an application process. Review https://www.devhut.net/2015/05/28/ms...ill-a-process/
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Word of warning:
    Quote Originally Posted by DMT Dave View Post
    Dim SLOpen, FlowPath, MyItem as String
    This declares MyItem as a String and SLOpen & FlowPath as Variants.


    To delcare all 3 variables as string, you need to use
    Code:
    Dim SLOpen as String, FlowPath as String, MyItem as String

    You MUST Explicitly declare variable types (unlike other programming languages).

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Adobe has published a document for interacting with Acrobat and/or Reader using VBA. I suspect that if an object is instantiated for the application and the document, it should be possible. I know that it's possible to populate a pdf form with Access data, so if one can interact like that, it should be possible to close a file and the app - I've just never tried. The data transfer has been covered in this forum before.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Closing a pop-up form?
    By drharb in forum Forms
    Replies: 3
    Last Post: 11-15-2016, 06:34 PM
  2. Run Code on Closing of DB
    By guillermoftw in forum Access
    Replies: 1
    Last Post: 12-16-2014, 11:48 AM
  3. Closing a form through VBA
    By ghostmachine in forum Forms
    Replies: 4
    Last Post: 12-13-2010, 01:57 PM
  4. Closing a combo box
    By Remster in forum Forms
    Replies: 5
    Last Post: 11-30-2010, 04:54 AM
  5. Compacting When Closing?
    By Sean04 in forum Access
    Replies: 5
    Last Post: 03-19-2010, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums