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

Posted on 2007-08-08
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
 Set xlApp = Nothing
Question by:mcgilljd
    1 Comment
    LVL 48

    Accepted Solution

    Have you gived any time to update the links ?

     With xlApp.Workbooks.Open(vFile, True)
      .Close True
     End With

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
    Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
    The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
    This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now