vba to close specific file (1 Viewer)

Monsora83

Registered User.
Local time
Today, 03:02
Joined
May 16, 2011
Messages
41
I have an adobe file that I constantly 'print' from access so that the most resent data from a report is available. This file stays open all the time (to be displayed on a projector) until it has to be reprinted. I would like to be able to put this on a timer so that the file will close, reprint, then open again all automatically. I have this all completed except for the closing part. For the life of me I can’t find the code to close a specific file using vba code.

My pathway for this file is:
C:\Documents and Settings\User1\My Documents\Rpt_Qry_Tbl_Data.pdf

Any help is welcome (or to at least know if this is even possible from access)
Thanks
 

boblarson

Smeghead
Local time
Today, 00:02
Joined
Jan 12, 2001
Messages
32,059
What is the rest of your code - how are you opening it? You would need to use an object to do it so you can retain control over it.
 

Monsora83

Registered User.
Local time
Today, 03:02
Joined
May 16, 2011
Messages
41
What is the rest of your code - how are you opening it? You would need to use an object to do it so you can retain control over it.

I made a separate form for this report where the form is using an OnTimer event it calls to print the specific report (using the DoCmd.OpenReport "Rpt_Qry_Tbl_Data"). I have adobe set up so that it will auto over-write the old file and open it full screen once it is made, so no code was needed for that. Really rather simple.

I can post exact code tomorrow when I have access to it again. But that is it.
 

Monsora83

Registered User.
Local time
Today, 03:02
Joined
May 16, 2011
Messages
41
This is all the code for what I have. As mentioned Adobes' setting handle the saving/opening/overwriting for me so I didn't need any code for that. And I have the Timer Interval set to ~15 minutes.

Private Sub Form_Timer()
DoCmd.OpenReport "Rpt_Qry_Tbl_Data"
End Sub
 

boblarson

Smeghead
Local time
Today, 00:02
Joined
Jan 12, 2001
Messages
32,059
This is all the code for what I have. As mentioned Adobes' setting handle the saving/opening/overwriting for me so I didn't need any code for that.

So if Acrobat is doing that then you will not be able to close it as there is no tie to it. You need to do the opening by setting it to an Acrobat document so that you can close it. If you have PDF Writer (from Acrobat) on your machines I can post code we use to handle all of the PDF stuff (including adding bookmarks).
 

Users who are viewing this thread

Top Bottom