我在Excel中有一个数据透视表,我可以通过打开具有连接属性-
的Excel来访问和刷新表我在此Excel的Macro模块中使用确切的属性-
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
错误“运行时错误'1004':应用程序定义或对象定义 错误。”出现在oledbCn.Connection中。
是什么原因导致的?如何获取更多调试信息?
在此先感谢您的帮助!
答案 0 :(得分:0)
找出问题所在。 “ OLEDB;”在“ 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"