1

I've a situation when by click on the button a Power Query text must be updated.

So what is needed to be done:

  • take the data that user provided as a files location and file names (no problem with that)
  • send to Power Query new location and file names, refresh the Query.

As I've seen, only Refresh is vba-described...

Does somebody have the information on how the text of Power Query could be modified?

1
  • In order to update a queries formula, you will need to delete the query and re add it with the updated formula... You can find the name and formula of a query: dim qry as workbookquery, qryName = qry.name, qryFormula = qry.formula, qryDesc = "Test description"... and with those 3 variables, you can create a query! Rather simple... With regards to refreshing the power query, just refresh the connection that begins with 'Query - ' :) Commented Jul 25, 2016 at 12:30

1 Answer 1

1

It's supported in Excel 2016 and later: https://gallery.technet.microsoft.com/office/VBA-to-automate-Power-956a52d1

Use the Workbook.Queries property to change the text.

Sign up to request clarification or add additional context in comments.

1 Comment

Could you please add a sample code here? I'll upvote the answer. This answer is currently not providing a solution

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.