Solved

Excel 2007 Query Table refresh date

Posted on 2010-09-24
1
728 Views
Last Modified: 2012-05-10
I'm trying to get the refresh date for a query table within Excel 2007 to use as a timestamp but am not getting any output when trying the following within the sheet containing the query table.

Private Sub QueryTable_AfterRefresh(Success As Boolean)
    If Success Then
        ' Query completed successfully
        Range("M1").Value = ListObject(1).QueryTable.RefreshDate
    Else
        ' Query failed or was cancelled
    End If
End Sub

If I insert a msgbox, it doesn't get launched either so it looks like I'm missing something.

Thanks
0
Comment
Question by:tdbj
1 Comment
 
LVL 5

Accepted Solution

by:
MAdS earned 500 total points
ID: 33759289
You need to instantiate the event first:

Public WithEvents QueryTable As QueryTable
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now