Using VBA code to instantiate object of Visual Foxpro DLL utilizing Regfree COM
Posted on 2010-09-11
Thank you very much in advance for any help anyone can offer because I am completely stuck:
My company purchased a set of dlls created with Visual Foxpro. I created a front-end app using VBA/Excel to manage and utilize these dlls. The app works fine if the dlls are registered and a reference is added to the app. The problem is we need to use it in a server environment and are not able to have multiple instances of the app running. This is also because the dlls open reference tables upon use and lock them until they are closed. We tried having multiple copies of the Excel app/dll folders in different folders, but that does not work since it seems you can only have one copy of a COM dll registered at a time, hence the need for regfree COM.
I tried creating manifest files for the dlls, but I am not sure if the manifests are the problem or if it's my code. This is the code that I used to get just one of dlls working:
Option Private Module
Dim oTemp4 As Object
Dim o As Object
Set o = CreateObject("Microsoft.Windows.ActCtx")
o.Manifest = "C:\Program Files\App\User 1\grccountry.dll.manifest"
Set oTemp4 = o.CreateObject("grccountry.grccountry")
'Code to use object
Set oTemp4 = Nothing
I get 'Runtime error 429 - Activex component can't create object'. I know I must be missing something, but I have spent several days searching and haven't had any luck. Can anyone help? Thanks.