Solved

Excel 2007 Query Table refresh date

Posted on 2010-09-24
1
786 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

622 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