Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Macro to execute on WEB Query Refresh

I have a macro I want to run after my WEB Query Refresh takes place. Any
assistance would greatly be appreciated.

Regards,

Donnie


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Macro to execute on WEB Query Refresh

Hi,

To execute some codes after Query refresh or before Query refresh;

1. add a class module to your VBA project. (assumed name is class1)
2. copy following line into your class module.

Public WithEvents qtQueryTable As QueryTable
Sub InitQueryEvent(QT As Object)
Set qtQueryTable = QT
End Sub

3. if you click Object Combobox to drop down, you'll see qtQueryTable on the
list. select it. there will be two events available for Query Table.
"AfterRefresh and BeforeRefresh". Write your code there.

4. before using these events, you need to set up your query table's
AfterRefresh and BeforeRefresh events using following code. (It could be in
worksheet's code or workbook's code)

Dim clsQueryTable As New Class1

Sub RunInitQTEvent(Optional FakeArg As Integer)
clsQueryTable.InitQueryEvent QT:=Sheet1.QueryTables(1) 'assumed
your query table in sheet1
End Sub

Private Sub Worksheet_Activate()
RunInitQTEvent
End Sub

'///// or /////
Dim clsQueryTable As New Class1

Sub RunInitQTEvent(Optional FakeArg As Integer)
clsQueryTable.InitQueryEvent QT:=Sheet1.QueryTables(1) 'assumed
your query table in sheet1
End Sub
Private Sub Workbook_Open()
RunInitQTEvent
End Sub


Good luck

Kind regards.


Haldun Alay




"Donnie Stone" , iletide şunu yazdı
...
I have a macro I want to run after my WEB Query Refresh takes place. Any
assistance would greatly be appreciated.

Regards,

Donnie




Reply
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
external data automatic refresh through macro/query Texas Tonie[_2_] Excel Discussion (Misc queries) 0 April 12th 07 07:52 PM
How can I 'Enable Automatic Refresh' for Query Refresh by default Anand Deshpande Setting up and Configuration of Excel 0 December 10th 06 04:47 AM
Query Refresh-Enable Automatic Refresh Dialogue Box Terri Excel Discussion (Misc queries) 0 May 6th 05 08:21 PM
Web Query Refresh - Automatically Run Macro Donnie Stone Excel Programming 1 September 19th 03 05:49 AM
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) Anant[_2_] Excel Programming 1 August 6th 03 04:22 AM


All times are GMT +1. The time now is 09:31 AM.

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

About Us

"It's about Microsoft Excel"