Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Refresh links in excel stay open  long enough to complete then save

Posted on 2007-08-08
1
Medium Priority
?
375 Views
Last Modified: 2011-09-20
I have a vb script that runs on a schedule.
It is supposed to open an excel file and refresh the links then save the file.
The problem it is that the  links take a few seconds to refresh and the file closes before it is done refreshing so i end up with a bunch of #NA where the data should be




Dim xlApp, vFile
 vFile = "C:\your file.xls"
 Set xlApp = CreateObject("excel.application")
 With xlApp.Workbooks.Open(vFile, True)
  .Close True
 End With
 xlApp.Quit
 Set xlApp = Nothing
0
Comment
Question by:mcgilljd
1 Comment
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 19656738
Have you gived any time to update the links ?

 With xlApp.Workbooks.Open(vFile, True)
   System.Threading.Thread.Sleep(200)
   Application.DoEvents
  .Close True
 End With
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question