View Single Post
 
Old 02-13-2015, 07:39 AM
Remster Remster is offline Windows XP Office 2003
Novice
 
Join Date: Dec 2011
Posts: 4
Remster is on a distinguished road
Default Converting VBA code to ADO

Hi Folks

I've been asked to debug some VBA code from a macro in a Word document that no longer works now we've moved to Office 2010. I'm told I need to convert the code to ADO. I'm unsure what this means and I'm a little bit out of my depth. Can anyone help me with this please? Here's the code:

Code:
Sub DutyOfCare2()
 
    Dim Db As Database
    Dim WkSpace As Workspace
 
    Documents.Add Template:="cwtn.dot"
    ActiveDocument.PageSetup.HeaderDistance = 0
 
    On Error Resume Next
    Application.StatusBar = "Opening Database"
    Set WkSpace = CreateWorkspace("Contender", "", "", dbUseODBC)
    Set Db = WkSpace.OpenDatabase("Contender", dbDriverComplete, False, "ODBC;DATABASE=/usr/username/v7/databases/live/username;...;...;DSN=Contender")
 
    If BuildDutyOfCareReps(Db) Then
        Dialogs(wdDialogFilePrint).Show
 
    End If
 
    Db.Close
 
    Application.StatusBar = "Ready"
 
    ActiveDocument.Saved = True
 
End Sub
Thanks

Remster

Last edited by Remster; 02-14-2015 at 01:31 AM. Reason: UserID & Password in code changed
Reply With Quote