want VBA code for auto refresh excel sheet?

Posted on 2011-04-28
Last Modified: 2012-05-11
want VBA code for auto refresh excel sheet in pre set secounds.i m using bloomberg add in so need to click on refresh every time
Question by:itjockey
    LVL 30

    Expert Comment

    You can do that by setting a timer in the workbook open event to refresh your connections?

    Lemme know if you want a sample?

    LVL 30

    Accepted Solution

    Here is an example

    Public RunWhen As Double
    Public Const TimeInterval = 60 '<~~ Seconds between updates
    Public Const RefreshMe = "UpdateLinks" '<~~ Name of procedure to run
    Private Sub Auto_Open()
        Call StartTimer
    End Sub
    Sub StartTimer()
        RunWhen = Now + TimeSerial(0, 0, TimeInterval)
        Application.OnTime EarliestTime:=RunWhen, Procedure:=RefreshMe, Schedule:=True
    End Sub
    Sub UpdateLinks()
        Application.ScreenUpdating = False
        '~~> Code here to Refresh
        ActiveWorkbook.UpdateLink Name:="SOME LINK", Type:=xlExcelLinks
        Application.ScreenUpdating = True
    End Sub

    Open in new window

    LVL 24

    Expert Comment

    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    I've recently been in need of an Excel macro that could add a letter before the text on multiple cells in an Excel document. My English is as it is, so I will try explain what it does diffrently. If you have an excel document with 2000 rows an…
    This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
    The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
    This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

    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