Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with VFP dll in Excel
Message
De
14/01/2001 11:13:14
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Problems with VFP dll in Excel
Divers
Thread ID:
00463519
Message ID:
00463519
Vues:
95
I have written a DLL using VFP 6.0 SP4. The DLL operates fine in VFP, but I'd like to also use it in, for example, Excel 97.


The code I use in VFP to use the DLL is:

oTest = CreateObject("refgen.ref_finder")
cName = oTest.getref("substanc", "numb", "AZZZD", 1)
Release oTest
MessageBox(cName)

The above code runs with no problems, and can be run multiple times without problems.

The code for my macro in Excel is as follows:

Dim oTest As Object
Set oTest = CreateObject("refgen.ref_finder")
cName$ = oTest.getref("substanc", "numb", "AZZZD", 1)
Set oTest = Nothing
MsgBox (cName)

This works fine when I run it once. However, if I run the same macro a second time I get the following error.

Run-time error '-2147467259 (80004005)':

Automation error
Unspecified error

The error occurs at the CreateObject line. To get the dll to work again, I have to shutdown and restart Excel.

Does anyone have any idea what this means ? I thought that maybe the object wasn't being destroyed properly, but it seems OK in VFP, and the debugger in Excel shows the value of oTest as being "Nothing".
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform