• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 816
  • Last Modified:

Excel 2007 Query Table refresh date

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
        ' 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.

1 Solution
You need to instantiate the event first:

Public WithEvents QueryTable As QueryTable
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now