LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Removing reference generates type mismatch error

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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Type Mismatch Error David Excel Discussion (Misc queries) 2 December 11th 05 04:46 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
"FIND" generates "Type mismatch" error quartz[_2_] Excel Programming 5 November 16th 04 03:29 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"