Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel 2007 Query Table refresh date

Posted on 2010-09-24
1
Medium Priority
?
806 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 2000 total points
ID: 33759289
You need to instantiate the event first:

Public WithEvents QueryTable As QueryTable
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

876 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