Reference Link MISSING when opened from an older version

jeffmoseler

Well-known Member
Joined
Jul 16, 2004
Messages
539
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?
 

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

DocAElstein

Banned user
Joined
May 24, 2014
Messages
1,336
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.
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,770
Office Version
  1. 2010
Platform
  1. Windows
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.
 

DocAElstein

Banned user
Joined
May 24, 2014
Messages
1,336
.. 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.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,405
Messages
5,528,573
Members
409,827
Latest member
Tmcgrew05

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top