Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (11.1k points)
How can I automate in VBA,so that i can run my Power Query automatically and copy this format into the sheet2

1 Answer

0 votes
by (22.5k points)

Add this formula then refresh and then connect

Dim pqFormula as String
pqFormula = "let..in"

Dim pqName as String
pqName = "<Name of the connection>"

' Update the formula for the specific power query.
ThisWorkbook.queries(pqName).Formula = pqFormula

' Refresh the connection
ThisWorkbook.Connections("Query - " & pqName).Refresh

Want to learn more about Power BI? Check out today: Power BI course     

Related questions

0 votes
1 answer
asked Dec 26, 2020 in BI by Chris (11.1k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...