Excel Macro - Auto Update Links

  • Thread starter Thread starter joopdog
  • Start date Start date
J

joopdog

I have this piece of Code:


Code:
--------------------
Sub auto_open()
' For Auto Updating Linked Files
'---
'Workbooks.Open Filename:=ActiveWorkbook.Path & "\Test_file_02.xls", UpdateLinks:=1
'---
End Sub
--------------------


When I run this code from "File 1" everything updates automatically,
great.
However, "File 2" remains open. Is there away to close the file?

Any help would be appreciated.
 
Try adding this line at the end:

ActiveWorkbook.Close True

Regards.
 
Thanks!

It works great!


Code:
--------------------
Sub auto_open()
' For Auto Updating Linked Files
Application.ScreenUpdating = False
Workbooks.Open Filename:=ActiveWorkbook.Path & "\Test_file_02.xls", UpdateLinks:=1
ActiveWorkbook.Close True
Application.ScreenUpdating = True
End Sub
--------------------


It updates without a flicker. "Test_file_02.xls" closes when "File 1"
opens to run the "auto_open" macro. You can move the files from folder
to folder without a hitch. It works great.

Again Thanks alot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top