tags:

views:

28

answers:

1

I need a vba macro to enumerate the queries on each worksheet of a workbook.

Can you provide example code?

Jerry E

A: 

Here you go:

Dim aSheet As Worksheet
For Each aSheet In Worksheets

    Dim aQueryTable As QueryTable

    For Each aQueryTable In aSheet.QueryTables

      ' Do something with aQueryTable, e.g.
        MsgBox aQueryTable.Name

    Next aQueryTable

Next aSheet
Jürgen Hollfelder
I am talking about queries that get external data. I just need to get a list of these queries by worksheet name.
jerry e
Hi Jerry, So I changed the answer. Did that help?
Jürgen Hollfelder