View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Application.OnTime driving me crazy

change
TimeValue("TimeCell2"),

to

TimeValue(TimeCell2),

--
Regards,
Tom Ogilvy

"Ron" wrote in message
10.201...
Hello vba gurus [green with envy, but learning]


I have a web query that needs refreshing periodically throughout the
day. Sometimes upto 20 times.
The web query URL is mostly static but has a 7 digit event number tagged
on the end.

i.e. http://webquery-site/market.asp?id=2211993

The url is static but the 7 digit number on the end changes every day,
and also several times through the day.

Ordinarily I do this manually but am going away for 2 weeks and want to
automate this so a friend can set it running on a morning and let it do
it's thing all day.

I have in column F a list of times ie 20:28:00 and in column H I have
the corresponding event id's ie 2211993, 2211994, 2211897 etc.

What I'm struggling with is getting the Application.OnTime procedure to
work correctly.

My code at the moment is..

Sub OnTimeTest()
Dim TimeCell2 As String
TimeCell2 = Sheets("test").Range("F2")
Application.OnTime TimeValue("TimeCell2"), "testProcedure"
End Sub


The variable TimeCell2 is the time that sits in cell F2.

The procedure "testProcedure" simply pops up a message box for now until
I get this right then I will link it to the sub that refreshes the
query.

I'm sure the solution is something simple but I'm at a loss now. I
think I'm going wrong on the syntax somewhere.

Any ideas guys?

Thanks

Ron