How to Change Excel Power Query Paramaters with VBA

心已入冬 提交于 2019-12-25 03:36:14

问题


How to change Excel PowerQuery Paramaters with VBA?

i.e. These Paramaters:

Right now the Paramater has a value of 8, and is used in refreshing all other power queries. How can I change this paramater with VBA?

The Macro recorder does not show anything.


回答1:


Thanks to QHarr, I figured it out. Simply edit the Power Query M Code - the Parameter value is first item in the Code.

e.g.

5 meta [IsParameterQuery=true, Type="Number", IsParameterQueryRequired=true]

5 is the Parameter Value.

To edit, use the "Formula" Property e.g.

ThisWorkbook.Queries([ParameterName]).Formula = 'New code here


来源:https://stackoverflow.com/questions/52703993/how-to-change-excel-power-query-paramaters-with-vba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!