1

could you please help with the following

I try to use Some.dll version 5.0 within my code. However, Excel has multiple reference for the same dll, with earlier versions like 4.0 If I run:

Set co = CreateObject("SomeClass.Object")

even if I created a reference in Tools->References for the newest Some.dll, it calls one of the oldest dll, that does not have some functionality.

I do not have admin right to change registry, remove programs from my computer.

Is it possible somehow set reference to the newest version dll?

I tried:

Private Declare Function LoadLibrary Lib "kernel32"...
lb = LoadLibrary(C:\somepath\Some.dll) ' lb is the 5.0 version dll that should be used
set co = CreateObject("lb.Object")

however, it is not working ("ActiveX... can't create object")

and looked through all the net, but could not find advise, how to create object with a specific dll path.

Please help, thanks: Jim

Jim Tailor
  • 31
  • 1
  • 3

2 Answers2

2

I could find sollution inbetween,

it is a function called CreateObjectFromFile() that helps.

CreateObjectFromFile("C:\somepath\Some.dll", "SomeClass")
Tom van der Woerdt
  • 28,143
  • 7
  • 67
  • 105
Jim Tailor
  • 31
  • 1
  • 3
1

I've met the same problem, and solved it this way:

Reference to old version:

Set co = CreateObject("SomeClass.Object.4.0")

Reference to new version:

Set co = CreateObject("SomeClass.Object.5.0")
Minamoto
  • 111
  • 4