Share via

Access 2016 Close a PDF document using VBA

Anonymous
2018-07-23T14:26:46+00:00

Hi  I need to check if a pdf file is open if it is I need to close it.

I have no problem checking if the file exists in the folder what I do need help with if the file is open how do I close it using VBA.

Dim app As Object, avdoc As Object

Set app =CreateObject ("AcroExch.App")

Set avdo = app.GetActiveDoc.strPath ' I have not put all the code in for the strPath 

     avdoc.Close

Set app = Nothing

Set avdoc= Nothing

The above does nothing no errors 

So basically if the AXC.pdf file is open in its folder I want to close it without making any changes.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2018-07-23T17:24:37+00:00

    Never used it but this looks promising...

    http://www.theaccessweb.com/api/api0025.htm

    Was this answer helpful?

    0 comments No comments