Hi,
i want to refresh specific workbook query based on its name:
but it is failing. How can i do this?![]()
Please Login or Register to view this content.
Best,
Jacek
Hi,
i want to refresh specific workbook query based on its name:
but it is failing. How can i do this?![]()
Please Login or Register to view this content.
Best,
Jacek
Please try this, where Table1 is your query name
![]()
Please Login or Register to view this content.
Thank you,
i will try.
So this is not possible from query name go to connection name or i have to create string manually with this "Query - " as first word?
Best,
Jacek
The query name is just Table1
There are many types of connection, "Query - " is to specify connection type.
Query.png
What if connection name is changed?
This will work only if you assume that connection name is a default power query name.
Best,
Jacek
I do not answer to "What if" question.
There will be next "What if" this, "What if" that, and the question will never end.
Provide your sample file and include all the "What if" in the completed scenario.
Thanks Bo_Ry,
sorry for honesty.
This is my full question.
I am not using connections just queries names and figuring out if this is possible to refresh WorkbookQuery based on its name not referring to connections. Or how to refer to connection from workbook query and refresh it?
It is not working for me because i have different connections names then "Query - " + name as PQ from default created.
Thank you for help,
Best,
Jacek
Hi Guys,
i have bad news.
I thik that looping through Workbook.queries object has no possiblity to refer to query table and refresh.
It is better to use for loop and loop with all listobjects and query tables...
Best,
Jacek
For a WorkbookConnection that is linked to a PQ query, the OLEDBCOnnection.Commandtext should be "SELECT * FROM [query name here]" so you could test that?
Everyone who confuses correlation and causation ends up dead.
Hi Rory,
thanks.
I have noticed it. But how could i still refresh OLEDBConnection refering to workbook query name only?
I have to locate where this query is from listobject i think.
Jacek
A WorkbookConnection has a Refresh method, so once you've found the right one from the Commandtext, just refresh it.
thanks Rory,
what i have only is:
Creator, Description, Formula and Name of workbookQuery.
Screenshot_164.png
i do not have oledb connection atribute.
Best,
Jacek
You're looping through the Queries, not the Connections.
Yes exactly.
i am looping with workbookqueries so only way to get to this is looping through workbook connections?![]()
Please Login or Register to view this content.
Best,
Jacek
Yes - those are the link between the query and the worksheet.
Ok,
thank you Guys for help and support.
Best,
Jacek
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks