Reference Link MISSING when opened from an older version

jeffmoseler

Well-known Member
Joined
Jul 16, 2004
Messages
540
I have the following code in a Function in Excel:

Code:
thisVINCharacter = Mid(workingvinnumber, x, 1)

Everytime someone opens it in Excel 2013 it updates the References from "Microsoft Outlook 14.0 Object Library" to "Microsoft Outlook 15.0 Object Library" . Then when I open it in Excel 2010 it errors out on the line above, highlighting the "Mid" function.

Is there a way to get the code to run regardless of the Object Library version?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I have the following code in a Function in Excel:

Code:
thisVINCharacter = Mid(workingvinnumber, x, 1)
....... . Then when I open it in Excel 2010 it errors out on the line above, highlighting the "Mid" function.......

. Hi Jeff,
. Not sure if this may Help…..
. I sometimes have similar problems with the VBA Left, Right and Mid Functions. Sometimes when I open up a file in XL 2007 which was saved in XL 2010 the VBA Left, Right and Mid Functions suddenly do not work giving a compiling error I guess similar to which you are experiencing.
. It appears to be related to the different Libraries, but as a Beginner I am not too sure of exactly where the problem lies.
. However the following has up until now always solved the problem for me:- Replace all these functions with the following
Left replace with VBA.Left
Right replace with VBA.Right
Mid replace with VBA.Mid
. The code then always works for me regardless of the XL version
. You may get some more insight into the problem from Zack Barresse here
http://www.mrexcel.com/forum/excel-...ions-functions-such-date-time-left-etc-2.html


Alan Elston.
 
Upvote 0
I don't know how you're using Outlook objects in your code, but if you switch from early to late binding, you can remove the reference to Outlook.

E.g., change from

Code:
  Dim oOL As Outlook.Application
  
  Set oOL = New Outlook.Application

to

Code:
  Dim oOL As Object
  
  Set oOL = CreateObject("Outlook.Application")

... and remove the reference. The code will load the latest libabry when it runs.

The downside is that you lose Intellisense for the Outlook objects, but that can be circumvented using conditional compilation, which allows you to develop early-bound and deploy late-bound.
 
Upvote 0
.. Just a quick last note from me… I was playing around again just now with my solution and that from shg. Both seem always eventually to work. But there is a small catch to be aware of. Changing / removing references or attempting my VBA. Solution sometimes was not allowed or gave a strange “ddl” error.
. Up until now restarting excel has usually done away with those issues.…and so finally both solutions always then seemed to work.
Alan.
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,854
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top