动态构建多维数据集连接
Dynamically Build Cube Connection
我在 Excel 中有一个 Pivot table,我可以通过使用连接属性打开 Excel 来访问和刷新它 -
我在这个 Excel 的宏模块中使用了确切的属性 -
Sub UpdateQueryConnectionString()
Dim cn As WorkbookConnection
Dim oledbCn As OLEDBConnection
Set cn = ThisWorkbook.Connections("http___xxxxx_olap_msmdpump.dll xxxx All xxxx")
Set oledbCn = cn.OLEDBConnection
oledbCn.CommandType = xlCmdCube
oledbCn.CommandText = "All xxxx"
oledbCn.Connection = "Provider = MSOLAP.8; Persist Security Info = True; User ID = xxxx; Password = xxxxx; Data Source = https://xxxxx/msmdpump.dll;Update Isolation Level=2;Initial Catalog=xxxxMAIN"
End Sub
An error "Run-time error '1004': Application-defined or object-defined
error." occurs in oledbCn.Connection.
什么会导致这种情况以及如何获取更多调试信息?
在此先感谢您的帮助!
找到问题了。 “有机发光二极管;”在“Provider = MSOLAP.8;”之前需要。
oledbCn.Connection = "OLEDB;Provider = MSOLAP.8; Persist Security Info = True; User ID = xxxx; Password = xxxxx; Data Source = https://xxxxx/msmdpump.dll;Update Isolation Level=2;Initial Catalog=xxxxMAIN"
我在 Excel 中有一个 Pivot table,我可以通过使用连接属性打开 Excel 来访问和刷新它 -
我在这个 Excel 的宏模块中使用了确切的属性 -
Sub UpdateQueryConnectionString()
Dim cn As WorkbookConnection
Dim oledbCn As OLEDBConnection
Set cn = ThisWorkbook.Connections("http___xxxxx_olap_msmdpump.dll xxxx All xxxx")
Set oledbCn = cn.OLEDBConnection
oledbCn.CommandType = xlCmdCube
oledbCn.CommandText = "All xxxx"
oledbCn.Connection = "Provider = MSOLAP.8; Persist Security Info = True; User ID = xxxx; Password = xxxxx; Data Source = https://xxxxx/msmdpump.dll;Update Isolation Level=2;Initial Catalog=xxxxMAIN"
End Sub
An error "Run-time error '1004': Application-defined or object-defined error." occurs in oledbCn.Connection.
什么会导致这种情况以及如何获取更多调试信息?
在此先感谢您的帮助!
找到问题了。 “有机发光二极管;”在“Provider = MSOLAP.8;”之前需要。
oledbCn.Connection = "OLEDB;Provider = MSOLAP.8; Persist Security Info = True; User ID = xxxx; Password = xxxxx; Data Source = https://xxxxx/msmdpump.dll;Update Isolation Level=2;Initial Catalog=xxxxMAIN"