Automatically update VBA references using multiple versions of Excel (2013, 2016, 2019, and Microsoft Office 365)

pingme89

Board Regular
Joined
Jan 23, 2014
Messages
170
Office Version
  1. 365
Platform
  1. Windows
I have an excel file with VBA code. This file is saved on Dropbox.
I open this file from multiple locations with different versions of Excel installed.
I get Can't find Project error when running the code because the Excel Versions are different.

How can I automatically update the Reference to the proper Excel Version.

Missing: Microsoft Excel 15.0 Object Library

I need code to be able to detect all versions of Excel and Outlook and update the references accordingly.
Can someone point me in the right direction?

Thanks in advance.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hello there,

The only way I know how to do this is via automation. The link below shows how to remove MISSING references and add them back. Should get you started. There's no real "good" solution for this IMO. Specifically for the Excel reference, your file should automatically update. The other way to reference objects is by using late binding, which will grab the systems current version if recognized. For example...

VBA Code:
    Set OutlookApp = CreateObject("Outlook.Application")

 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

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