We help IT Professionals succeed at work.
Get Started

Excel 2007 External Data Connection problem

pwken
pwken asked
on
1,781 Views
Last Modified: 2012-05-10
I have an Excel workbook that contains 3 connections to an Oracle Database. The code I used to open the connection is apparently not compatible with Office 2007. I have spent many hours trying to decipher what it is that I need to do to make this work for both Office 2007 and Office 2003. Can someone please take a look at the code I have included and give me some examples of replacement code.
Dim wrkODBC As Workspace
Dim conORAP039 As Connection

Function Some_Function()

SetConnectionObject

'Run GetVehicleModels_Connection query "VEHICLE_MODEL" on 'Lists' worksheet

Sheets("Lists").Range("A1").QueryTable.Refresh BackgroundQuery:=False

End Function

Private Sub SetConnectionObject()
   
    ' Create ODBCDirect Workspace object and open Connection objects.
            
Set wrkODBC = CreateWorkspace("NewODBCWorkspace", "xxxxxx", "xxxxxx", dbUseODBC)

Workspaces.Append wrkODBC

    ' Note: The DSNs referenced below must be configured to
    '       use Microsoft Windows NT Authentication Mode to
    '       authorize user access to the Microsoft SQL Server.
    
Set conORAP039 = wrkODBC.OpenConnection("ORAP039", dbDriverNoPrompt, True, _
                     "ODBC;DATABASE=ORAP039;UID=xxxxxx;PWD=xxxxxx;DSN=ORAP039")
  
End Sub

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 12 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE