+ Reply to Thread
Results 1 to 2 of 2

Formatting after Web Query Refresh

  1. #1

    Formatting after Web Query Refresh

    Hi friends

    I am using a Web Query to download some stock related data.
    The fonts on the web page are of small size and the heading are
    in black color as well the data too.

    What I did to change the size and color is :

    Range("B12").Font.Bold = True
    Range("B12").Font.Size = 10
    Range("B12").Font.Color = RGB(255, 0, 0)

    I have written this code after refreshing the web query. This piece of
    code works
    for some time....but then font and other things get their original
    color and size...
    The effect is till the refresh icon is working after that no use of
    this piece of code.
    I have written this code after the refresh event!!!!!!!!!!

    Please put some light on this area.....

    Thanks in advance
    Anand


  2. #2
    K Dales
    Guest

    RE: Formatting after Web Query Refresh

    Unless you set it up otherwise a query will do a background refresh; that is,
    it allows work to continue in Excel while it waits for the data. This also
    means your code can continue to run. There are two ways around this:
    1) Set the .BackgroundQuery property of the querytable to False
    2) In your code you can check to see if the refresh is done with a loop, as
    illustrated below (and I am also including a time-out in case the web data is
    unavailable):
    TimeOut = Now()+TimeValue("00:02:00") ' 2 minute timeout
    My QueryTable.Refresh
    While MyQueryTable.Refreshing And Now() <= TimeOut
    DoEvents
    ' you can do other processing here, also, if needed
    WEnd
    ' put your formatting code here

    --
    - K Dales


    "[email protected]" wrote:

    > Hi friends
    >
    > I am using a Web Query to download some stock related data.
    > The fonts on the web page are of small size and the heading are
    > in black color as well the data too.
    >
    > What I did to change the size and color is :
    >
    > Range("B12").Font.Bold = True
    > Range("B12").Font.Size = 10
    > Range("B12").Font.Color = RGB(255, 0, 0)
    >
    > I have written this code after refreshing the web query. This piece of
    > code works
    > for some time....but then font and other things get their original
    > color and size...
    > The effect is till the refresh icon is working after that no use of
    > this piece of code.
    > I have written this code after the refresh event!!!!!!!!!!
    >
    > Please put some light on this area.....
    >
    > Thanks in advance
    > Anand
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1