Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88126

Update queries in Excel using VBA

$
0
0

I have a query (Query1) loaded into Excel by using a connection from Teradata. Normally when I want to update the query, I have to right click it and choose edit.

enter image description here

Once inside the Power Query Editor, I can open the Source and edit the SQL script inside to update the query.

enter image description here

The question is how can I edit this SQL script using VBA?

Upon trying to use the Macro Recorder, I can only refresh the query using

ActiveWorkbook.Connections("Query - Query1").OLEDBConnection.Refresh

An attempt to edit the CommandText also failed. Here is the properties of the query.

enter image description here


Viewing all articles
Browse latest Browse all 88126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>