Q
quartz
I am using Office 2003 on Windows XP.
When distributing programming solutions I have encountered a situation in
which one user has Office 2003 and another user of the same file has a
previous version of Office. All users have at least Office 2000 or greater.
I have a function that creates a reference to ADO programmatically and it
works fine, unless an Office 2003 user is the last user of the file. ADO
references will go forward, but not backward. So I need to remove the ADO
reference on exit, then re-reference ADO on open each time.
I can work all this out, except my removal function gives me a "Type
mismatch" error.
1) My functions follow, can someone please correct my code and/or post code
of your own to deal with this?
2) Also, does it seem as though my approach will thoroughly fix my issue?
Public Function ADOReferenceAdd()
'PROGRAMMATICALLY ADD AN ADO REFERENCE
On Error Resume Next
ActiveWorkbook.VBProject.References.AddFromFile "C:\Program Files\Common
Files\System\ado\msado15.dll"
On Error GoTo 0
End Function
Public Function ADOReferenceRem()
'PROGRAMMATICALLY REMOVE AN ADO REFERENCE
On Error Resume Next
ActiveWorkbook.VBProject.References.Remove "C:\Program Files\Common
Files\System\ado\msado15.dll" '<type mismatch error here (fix line wrap)
On Error GoTo 0
End Function
Thanks much in advance for your assistance.
When distributing programming solutions I have encountered a situation in
which one user has Office 2003 and another user of the same file has a
previous version of Office. All users have at least Office 2000 or greater.
I have a function that creates a reference to ADO programmatically and it
works fine, unless an Office 2003 user is the last user of the file. ADO
references will go forward, but not backward. So I need to remove the ADO
reference on exit, then re-reference ADO on open each time.
I can work all this out, except my removal function gives me a "Type
mismatch" error.
1) My functions follow, can someone please correct my code and/or post code
of your own to deal with this?
2) Also, does it seem as though my approach will thoroughly fix my issue?
Public Function ADOReferenceAdd()
'PROGRAMMATICALLY ADD AN ADO REFERENCE
On Error Resume Next
ActiveWorkbook.VBProject.References.AddFromFile "C:\Program Files\Common
Files\System\ado\msado15.dll"
On Error GoTo 0
End Function
Public Function ADOReferenceRem()
'PROGRAMMATICALLY REMOVE AN ADO REFERENCE
On Error Resume Next
ActiveWorkbook.VBProject.References.Remove "C:\Program Files\Common
Files\System\ado\msado15.dll" '<type mismatch error here (fix line wrap)
On Error GoTo 0
End Function
Thanks much in advance for your assistance.