Hello, Please your help, VBA codes or in Power Quey: Extract the Visual Position of Queries as they appear in the "Workbook Queries" Pane.
I have, in Excel 2016 version:
A- Workbook, that contains 293 power queries, (lot of tables and lot of names around 2000 each), It does not store store and will never store Macro.
B- workbook called MacroStorage, that contains 0 query. it contains all Macros.
C- I want to Extract Queries Visual Position as they appear in the "Workbook Queries" pane to the right of excel screen, in the Workbook I designate, select, that contains the Power Queries and dump the main output and the End Summary Output as per the specifications attached as photo and below, in a worksheet I designate, i will imput it, responding to a Prompt, inside the same designated Workbook.
' ====================================
D- The following are the Main outtput Column Names with their Sequence
| ColumnSequence| ColumnNames |
--------------------------------------
| 1 | QueryName |
| 2 | QueryVisualPosition|
| 3 | QueryGroup |
-------------------------------------
' ===================================
E- Specifications
if the specifications here distorted Please the Specifications attached: Macro Refresh All Queries info Output Specifications.png
ColumnSequence| ColumnNames | Extracted Output Expected | Columns Wrapped at Width(*)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | QueryName | Power Query Name | 30
2 | QueryVisualPosition| Position (Numeric) of a query as it appears on the "Workbook Queries" Pane on the right of Excel Screen (**) | 20
3 | QueryGroup | The Query Name as it appears on the "Workbook Queries" Pane on the right of Excel Screen, with the Number of queries inside that Group between brackets []| 16
(*)Later after I have a complete correct Code output, the output visual will dictate and I will update the Column Width required.
(**) Please see Sample of "Workbook Queries" Pane attached
F- with the following Prompts allowing me to input:
'Prompts List
'=== 1. WORKBOOK SELECTION (NUMBERED) ===
'List ALL open workbooka and number them
'Open Workbooks :
'1: MacroStorage . xlsm
'2: Gas stat val Aug 13 2025. xlsx
'3: bslddehoqoh.xlsx
'Prompt user to select workbook, where the queries are, number or input its Name.
'=== 2. SHEET NAME ===
'Prompt for sheet name (no defaults).
'Input worksheet Name where you want to dump the output of this Macro
'option: Cancel
'=== 3. CLEAR Designated WorkSheet ===
'Prompt for whether to clear existing sheet data before writing.
'Yes No Cancel
'=== 4. OVERWRITE HEADERS of Designated WorkSheet ===
'Prompt for whether to clear the Header of Designated WorkSheet before writing
'Yes No Cancel
'=== 5. SLOW THRESHOLD ===.
'Enter the Time in second if a processing Query depased it Consider Long time
'Set Default Threshold to 1 minute. To be adjusted later based on the result of actual refreshing time
'=== 6. FINAL CONFIRMATION ===
'The Program MUST Display the list of Prompts ACTUALLY EXECUTED with their Numbers, Not a PrePrinted.
'Ok Cancel
'=== 7. Run or Cancel ===
'10.1. Run
'10.2. Cancel
' ==========================================================
G- Please stricly following the table specification attached:
Please study what is the output Must reveil per columns from the table attached:
Please Note:
N.1- Do Not Change any Name, or structure, before you ask me, If you want to differentiate version or any, write comment inside the codes.
N.2- Please never send Partial or correction code. Only Complete Code. (Ater around 80 hours of trails and failure between you and Deepseek, I am not Reading, because I am learning NOTHING)
N.3- Color the output of query row Having any type of issue with each issue different color.
N.4- Do not mask any error, let it breaks and we repair it.
N.5- Do it Dynamic, no Hardcoding unless in the test.
N.6- Create Summary screen of the ACTUAL Prompts EXECUTED with its sequence. Immediate after the Prompts, before "Run" or "Cancel" Icons
N.7- Create:Timer/Counter at the bottom left in excel Taskbar. "1 of Total Queries | Time Elapsed 04:49" Allow me to Manually Erase it.
N.8- Create three Separate Buttons to:
1. Button to stop Refresh [Stop Refresh],
2. Button to Clear Log [Clear Log] and
3. Button to erase Counter.Timer [Click to Erase Counter.Timer],
each between square bracket, and place them 1/10 inch above the Counter.Timer
N.11- Later after I have a complete correct Code output, the output visual will dictate and I will update the Column Width required.
N.12- Separator is: " ," space and comma
N.13- To save time and writing, please Do not Answer till we agree that you receive what I have and all you want.
N.14- I intend to use the Correct Macro On Different Workbooks and dumping output into different Workseet Name.
N.15- I will run the Macro from Inside the Active Workbook where the Queries are.
N.16- Create Report after the Macro Ends Summarizing the extraction, Like the one below:
* Later after I have a complete correct Code output, the output visual will dictate the Column Width required
**** Never change any Name before you ask me. Want to differentiate, write a comments, inside the codes
Separator is: " ," space and comma
Sample Workbook Queries Pane