AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 2,073
- Office Version
- 2019
- 2010
- Platform
- Windows
I want to open a new workbook, paste in some code and run it. But it requires a reference that isn't present
So I run
However this tells me "User defined type not defined' and highlights an entry in the declarations section.
I then have to rem this out, run the code and then undo the Rem
Is there any way Excel can have this reference all the time, so it doesn't need to be added.
So I run
VBA Code:
Sub MySub()
Application.VBE.ActiveVBProject.References.AddFromFile "C:\WINDOWS\$hf_mig$\KB2698365\SP3QFE\msado28.tlb"
End Sub
I then have to rem this out, run the code and then undo the Rem
Is there any way Excel can have this reference all the time, so it doesn't need to be added.