![]() |
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 |
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 " 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 |
All times are GMT +1. The time now is 05:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com