无法在Windows 10中运行Excel VBA宏

时间:2018-03-13 12:04:33

标签: excel vba windows-10 windows-7-x64 excel-2013

我有一个VBA项目,它连接到Oracle DB并运行一些SQL查询。现在,代码在Windows 7机器中运行顺畅,但在Windows 10中没有。我的连接字符串如下:

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sConnString As String

sConnString = "Driver={Microsoft ODBC for Oracle}; " & _
              "CONNECTSTRING=(DESCRIPTION=" & _
              "(ADDRESS=(PROTOCOL=TCP)" & _
              "(HOST=" & "localhost" & ")(PORT=" & "19005" & "))" & _
              "(CONNECT_DATA=(SERVICE_NAME=" & "XXXXXXXX" & "))); uid=" & username & " ;pwd=" & pwd & ";"


Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open sConnString

我附上了使用Excel 2016在Winidows 10中运行时收到的错误消息的屏幕截图。

Windows 10 Screenshot - Excel 2016

代码是在Windows 7机器的Excel 2013中编写的。对此有何解决方案?

0 个答案:

没有答案