LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default auto refresh

I am trying to use code to have the links in my spreadsheet update
automatically. I've been using Application.OnTime Now +
TimeValue("00:10:00"), "updateLinks" to call a procedure that does just that,
but here's where I am having trouble. I want to be able to leave the
spreadsheet open in the background while I work in other windows and Excel
spreadsheets. For the code I am using to work, I have to activate the
workbook I want to refresh. I can simply add code referring to it by name,
but I'd like something more flexible. I'd like to assign a variable to the
workbooks name (x = ActiveWorkbook.Name) and then retain the value of that
variable as the code continues to cycle. That way the file name can change
and the code will still work. I know how to pass a variable's value when
calling a procedure, but the OnTime method does not seem to allow me to do
that the same way. Is there another method I could use? Any code that will
automatically execute every so often while the workbook is open would be
appreciated. Here's what I've been trying to make work:

Sub refreshTimer()
x = ActiveWorkbook.Name
Application.OnTime Now + TimeValue("00:00:03"), "updateLinks"
End Sub

Sub updateLinks()
Workbooks(x).Activate
ActiveWorkbook.UpdateLink Name:="G:\BOGAC\SWAP05\RISKJEN.xls", Type:= _
xlExcelLinks
Call refreshTimer
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Refresh George Excel Discussion (Misc queries) 3 September 18th 09 04:33 PM
Copy Excel functions formula and auto refresh refresh Pauline Cheong Excel Worksheet Functions 3 February 16th 09 01:23 AM
How can I auto refresh a column that has an auto filter in place Pastal Excel Discussion (Misc queries) 1 December 18th 07 11:43 AM
How can I auto-refresh auto-filters when data changes? Mike@MPWco Excel Worksheet Functions 0 July 4th 06 12:50 PM
Auto-Refresh gregory.barrett Excel Discussion (Misc queries) 0 March 29th 06 06:54 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"