0

您好,有人建议我尝试学习办公脚本,并尝试将现有的基于 vba 的解决方案转换为办公脚本。现有解决方案编写 DAX 查询并返回 Excel 表。我在打字稿中找不到如何访问它。

VBA 是

Function GetDataFromDataModel(myDAXScript As String) As ListObject
Dim myDaxHubTable As ListObject
Set myDaxHubTable = blwModel.ListObjects("dxtDAXHub")


With myDaxHubTable.TableObject.WorkbookConnection.OLEDBConnection
        .CommandText = myDAXScript
        .CommandType = xlCmdDAX
End With
'Debug.Print myDAXScript
    ActiveWorkbook.Connections(myDaxHubTable.TableObject.WorkbookConnection.Name).Refresh
    
   Set GetDataFromDataModel = myDaxHubTable

End Function
4

1 回答 1

0

不幸的是,今天不支持此功能。如果有帮助, DataConnectionCollection.refreshAll可用于现有连接。

于 2021-09-07T22:02:35.843 回答