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: 1
Default getting VBA to pause while external data loads from web

Hi,

A quick question for you VBA gurus
Say I have a program that goes through a loop and downloads web site
into an excel spread sheet, once the contents (news releases) ar
there, I read off the time stamps and the headlines.
I used to have this done in two stages where I first ran a shell scrip
job to download the sites and save them locally in separate files -
then had a VBA routine run through them to get the info.
I'm now trying to do both steps within the same program and the proble
comes up when the page is still loading and the code runs further - i
already tries to read but there's still nothing there.
Is there any way I can get it to wait till the external data i
loaded?

Here's a snippet of the code:


'within the outside loop not seen here, I go through the tickers an
the dates and specify the URL to go to as a function of this inf
("CompleteAddress" variable below)

Wit
ActiveWorkbook.Worksheets("WebSiteContents").Query Tables.Add(Connection:="URL;
& CompleteAddress
Destination:=ActiveWorkbook.Worksheets("WebSiteCon tents").Range("A1"))
.WebFormatting = xlNone
.RefreshPeriod = 0
.RefreshStyle = xlOverwriteCells
.Refresh
End With

'now I run through the website, take time stamps and headlines an
output them along with the ticker/date

ActiveWorkbook.Worksheets("Output").Cells(i, 1).Value = Ticker
ActiveWorkbook.Worksheets("Output").Cells(i, 2).Value = Day & "/"
Month & "/" & Year

' The headline stamps start in row 23 column k and go
' down in steps of 2. The headlines are in column n
' and respective rows
For j = 23 To (MaxReleases * 2 - 1) + 23 Step 2
TimeStamp = ActiveWorkbook.Worksheets("WebSiteContents").Range ("k"
j).Value
Headline = ActiveWorkbook.Worksheets("WebSiteContents").Range ("n"
j).Value
ActiveWorkbook.Worksheets("Output").Cells(i, j - 20).Value = TimeStamp
ActiveWorkbook.Worksheets("Output").Cells(i, j - 19).Value = Headline
Next

--
Message posted from http://www.ExcelForum.com

 
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
PAUSE EXCEL MACRO FOR INPUT OF DATA VARIABLE lynne b Excel Discussion (Misc queries) 3 September 11th 06 03:37 PM
Macro Pause during Dialog Box data entry kayabob Excel Discussion (Misc queries) 6 October 20th 05 02:58 PM
Pause Macro to enter data in cell Frank Kabel Excel Programming 4 May 30th 04 10:56 PM
Pause Macro to enter data in cell Bob Phillips[_6_] Excel Programming 0 May 28th 04 04:41 PM
Programing a macro to pause while running for data entry Don Guillett[_4_] Excel Programming 0 August 27th 03 12:14 AM


All times are GMT +1. The time now is 08:58 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"