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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 817
  • Last Modified:

want VBA code for auto refresh excel sheet?

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
0
Naresh Patel
Asked:
Naresh Patel
  • 2
1 Solution
 
SiddharthRoutCommented:
You can do that by setting a timer in the workbook open event to refresh your connections?

Lemme know if you want a sample?

Sid
0
 
SiddharthRoutCommented:
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


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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now