Macro upgrade from word 2003 to word 2007
Posted on 2010-11-30
I have a customer who is upgrading from word 2003 to Word 2007. They have a macro that writes a unique id and initials etc into the footer of the word document.
I can't seem to get this working. I'm not a developer and ther person who wrote it orginally is no longer available.
i'm getting the following error message.
user defined type not defined. Resolved this by adding in the reference "Microsoft DAO 3.51 Object Library.
Now getting the following error:
Complile error: Invalid use of New keyword.
The following section is highlighted:
Function GetID() As String
On Error GoTo eh
Dim cn As Connection, rs As Recordset
Set cn = New Connection
cn.Provider = "microsoft.jet.oledb.4.0"
cn.ConnectionString = "\\fileserver\counter$\id.mdb"
Set rs = New Recordset
rs.Open "SELECT * FROM idTable", cn, adOpenStatic, adLockOptimistic
GetID = rs("ID")
Set rs = Nothing
Set cn = Nothing
MsgBox "An error occured " & Err.Description, vbInformation