Removeing an Object Library Reference with VBA runtime error 9

Liz_I3

Well-known Member
Joined
Dec 30, 2002
Messages
647
Office Version
  1. 2016
Platform
  1. Windows
Hi am working with Access 2010. I am want to remove a reference from the library with VBA
I am using the below function
Public Sub RemoveReference(strReferenceName As String)
Access.References.Remove Access.References(strReferenceName)
End Sub

Calling from an Event Procedure

Call RemoveReference("Microsoft Outlook 14.0 Object Library")

I have also tried RemoveReference("C:\Program Files (x86)\Microsoft Office\Office14\MSOUTL.OLB") but keep getting Runtime Error9 Subscripted out of Range

What I am missing

Thanks
L
 
Re: Excel help please

Hi, welcome. Post your Excel questions in the Excel forum: Excel Questions

Provide as much information as you can as your question seems difficult and would definitely require more information for anyone to be able to assist.

Good luck,
Xenou.
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

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