excel - 动态构建多维数据集连接
问题描述
我在 Excel 中有一个数据透视表,我可以通过使用连接属性打开 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
错误“运行时错误'1004':应用程序定义的或对象定义的错误。” 发生在 oledbCn.Connection 中。
什么可能导致这种情况以及如何获得更多调试信息?
提前感谢您的帮助!
解决方案
发现了问题。“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"
推荐阅读
- javascript - 将文本阴影转换为内联 SVG 样式的内联投影
- python - Networkx 中 Louvain 分区的可视化
- jenkins - 执行 ansible 脚本时 MODULE FAILURE 错误
- javascript - 在 JavaScript 仍在执行代码时显示图标
- java - sonatype nexus 3. maven-metadata.xml 的下载速度非常慢
- python - 如何将 Excel 公式应用于第一行被阻止的数据框
- python - 如何使用包含用 YAML 加载的单引号的键从集合中获取值?
- javascript - 使用 java-script 以最少的代码返回字符串中每个单词的第一个字母
- javascript - 使用 cypress 重定向到另一个域 url
- javascript - swiper.js - 销毁后出现“this.params is undefined”错误(真,真)