Topics Search

vba to close specific file

vba to close specific file
Views: 72
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 cant 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)
Sponsored Links:

Similar posts...


Drag And Drop File VBA

Drag And Drop File VBA Icon
I want to be able to drop a file into a specific are of an access form that will trigger VBA to save that file into a specific directory and rename it with data from fields in the open form.

Can anyone point me in the right direction on what control I might be able to use that will allow an Access form to recognize that a file is being dropped into it, 'take control' of thefile and kick off the appropriate VBA to save the file out to where I need it stored?

Secondly, once I have this down I'd like to know how to have a link to the file auto populated in a field of that same form.

close a specific report with VBA

close a specific report with VBA Icon
I have an open report on the desktop and want to close it with

Very First Step In Launching an Application?

Very First Step In Launching an Application? Icon
I just recently upgraded from Access 97 to 2007. Our department inherited and application program programmed in Access (user interface for extracting specific data) that was programmed by somebody else using lots of VBA code.

There are only 2 things suprisingly that are not functioning 100%. What I would like to know is what is the first command that happens when I double click the application to launch it. One issue I have is a form is launched that I always have to close out before I can use the application properly.

I want to see if I can either remove that pesky form from lauching or moving it down later in the sequence so I don't have to close it everytime.

Also, I placed the application and supporting files in the "Trusted Location", but I am still asked to "enable" the file before I can launch it.

I have about 3% knowlege of VBA programming BTW

Running a Delete (Records) Query on Close

Running a Delete (Records) Query on Close Icon
I have no experience with VBA (which I am thinking may be the only solution to this problem) but I want to be able to have Access (2003 or 2007) run a Delete Query of this one table right before someone decides to close down the database. The reason for this is that the only way autonumber will reset is if you delete the records in a table and compact the database. The compacting portion was already set within the options menu, but now I am looking to have all records deleted on close. Can someone help me out? Also, if VBA is the only way, can someone walk me through on how to accomplish this. I have yet to begin teaching myself VBA or SQL.

From Access unable to close Word with VBA

From Access unable to close Word with VBA Icon
Using Microsoft Office 2007, and Windows XP. In Access 2007 a Word document is created, text is added, and Word closed with VBA. Then unable to open the document because it is 'locked by user'.
Dim wo As Word.Application
Dim path As String

Set wo = CreateObject("Word.Application")
wo.ActiveDocument.SaveAs FileName:=path

'Text added to the document

wo.ActiveDocument.Close False
Set wo = Nothing
**********End of Code******************

The code is successful in creating the document and when looking in the directory, the file is there but with ~owner's file. When attempting to open the file with VBA, the message states the file is locked by the user who created the file.

How to close a spreadshee without Excel message

How to close a spreadshee without Excel message Icon
I have a macro to export an Access table to a text file. Then I use an Excel macro to open the text file and copy/paste to an Excel template. In the Excel macro, I write a code below to close the text file:


The Excel prompts a standard massage with 3 buttons: save, notsave and cancel. Everytime, I click the notsave button to close the text file.

Is there a way to write some codes to bypass this standard message? What I want is to close down the text file without any change

Bypass beforeclose event

Bypass beforeclose event Icon
So I am pulling data using code out of excel from access.

When I am done, I use the .quit or .close, but the excel file has a before close event that brings up a special msgbox.

How do I bypass the before close event. I dont want to save the file or anything, I just want to close excel without the before close event running

Pulling Specific Data from Excel

Pulling Specific Data from Excel Icon
I have a database that needs to pull specific data from Excel.

Specifically, one specific Access field should go directly to a specific
cell in Excel and get that value.

I'm thinking that I use some kind of VBA code to open my
Excel file and assign the cell contents to a variable
which I then use in Access. I think I can find the cell
in Excel using a named range.

I need the exact code, though.

Find path of file in different folder than the current Database

Find path of file in different folder than the current Database Icon
Is there any way to find that path of a file that does not exist in the same folder as the database? I have been looking around and I've only found ways to find file names in specific paths. When I hand over the database to the user, I'm not sure if they'll keep the two files (the Database itself and an excel file) together, so I want to eliminate coding a specific path (or CurrentProject.Path) into my vba

VBA Code To Global VBA

VBA Code To Global VBA Icon
s I have a question about saving VBA As Global Module.

While working with Access and VBA There are many VBA codes which we use very frequently for example:
Private Sub close_Click()
End Sub

How to save this as Module and then call to a button
Sponsored Links: