So in Excel 2016, they have this neat tool called Power Query, basically a glorified excel table. Every table has steps in it for filtering, removing columns, etc... The first step is the source step, to assign a connection string basically to retrieve data, normally this source just points back to the query which created it.
Anyways, I'm trying in VBA to dynamically change the source of these power queries, anyone have any ideas?
I tried using the whole connections vibe, but was unsuccessful.
You can access the query through ActiveWorkbook.Item. You can then modify the Formula property. You can find the documentation on these objects here.
Please note that the Power Query object model was only added to VBA in Excel 2016 and cannot be accessed in prior versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With