You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Excel在远程桌面打开ADODB连接时崩溃的问题求助

问题

本地Office Professional Plus 2016(Win32)环境中,使用ADODB连接读取关闭的工作簿运行正常;将文件复制到网络路径后,在远程桌面的Office Professional Plus 2010 32位环境下,执行cnn.Open constr时Excel直接崩溃,无VBA错误提示,仅能获取APPCRASH事件信息。

相关VBA代码

Sub GetData()

    'To get data from closed Store Master File
    Dim strSQL As String ' used to execute a request
    Dim strSfile    As String ' the name of the source file
    Dim strServer   As String ' the drive where the source file is located
    Dim strpath     As String ' the path on the drive where the file is located
    Dim sFile       As String ' concat of server/path/file
    Dim constr      As String ' the connection string
    Dim cnn         As New ADODB.Connection ' the connection
    
    'Set connection to the Store Master file
    strServer = "P:\"
    strpath = Sheets("Control").Range("A2").Value
    strSfile = Sheets("Control").Range("A5").Value
    sFile = strServer & strpath & strSfile
    constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & sFile & "';Extended Properties=""Excel 12.0;HDR=YES;"";;"
    
    'Open connection
    cnn.Open constr '  the problem line
    
    '.... other lines of code
    
    cnn.Close
End Sub

已确认信息

  • 变量sFile对应的文件路径正确,可手动正常打开目标工作簿
  • 崩溃精准发生在cnn.Open constr代码行,无VBA层面的错误提示

崩溃事件详情

问题事件名称: APPCRASH
应用程序名称: EXCEL.EXE
应用程序版本: 14.0.7256.5000
故障模块名称: mso.dll
故障模块版本: 14.0.7257.5000
异常代码: c00000005
异常偏移: 00bb441f
操作系统版本: 6.1.7601.2.1.0.16.7
区域设置 ID: 3081
附加信息:
LCID: 1033
skulcid: 1033

解决方法

1. 调整ADODB连接字符串

针对Office 2010和网络路径场景,修改连接字符串:

constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sFile & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1;"";"
  • 移除Data Source的单引号,避免网络路径解析冲突
  • 添加IMEX=1强制以文本格式读取混合数据类型,规避类型识别崩溃
  • 将Excel 12.0改为Excel 12.0 Xml,适配xlsx格式的标准解析

2. 验证ACE驱动兼容性

确保远程桌面环境安装了32位Microsoft Access Database Engine 2010 Redistributable,驱动位数必须与Office 2010(32位)一致,否则会引发兼容性崩溃。

3. 改用UNC路径替代映射驱动器

将映射驱动器P:\替换为网络共享的UNC路径(如\\服务器名\共享文件夹\),映射驱动器在远程桌面会话中可能存在权限或会话隔离问题:

strServer = "\\服务器名\共享文件夹\"

4. 检查文件访问权限

确认远程桌面用户对目标网络文件及所在文件夹拥有读取+写入权限(OLEDB连接即使仅读取数据,也可能需要临时写入权限),同时检查共享文件夹的NTFS权限和共享权限设置。

5. 修复Office 2010组件

错误信息显示故障模块为mso.dll,可能存在文件损坏,运行Office修复:

  • 打开控制面板 → 程序和功能 → 找到Microsoft Office 2010 → 右键选择「更改」→ 选择「修复」

内容的提问来源于stack exchange,提问作者ScanGuard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 10:42:03