Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Excel Automation Problems
Hi all, I've got a weird problem trying to use an COM automation server that I created using VFP within Excel. It's making no sense to me, so any Excel Automation Guru advice would be greatly appreciated.
Thanks.
-Matt
Here are the steps that I've used to recreate the problem.
I've created a new Com Server DLL with VFP 7 or 8 called 'VfpComServ'
-Open Excel 2002
-Go into Tools/Add-ins, select [Automation], find "VfpComServ" and select it.
-Now call one of the custom methods from a cell Ie. =GetSales("Mar","2002")
-This works fine.
-Save workbook and close Excel
-Open Excel again and re-open the saved workbook.
-Recalculate the workbook using Ctrl+Alt+F9 - all cells referencing the DLL methods are now changed to read "#Name?". The link to the COM Server is dead.
I've tried:
-Using regsvr32 to load and unload the DLL - no effect.
-Using the Tools/Add-ins, select [Automation] and browse to the actual DLL & answer "Yes" replace existing reference - no effect.
-Recreating the com server by rebuilding it using VFP - no effect.
The only thing that works is this sequence of events:
-With Excel still open, open a command window and manually unregister the DLL REGSVR32 vfpComServ.dll /U
-In Excel, go back to Tools/Add-ins and de-select the checkbox for vfpComServ - Excel will squawk saying that it doesn't recognize that add-in and ask if you'd like to remove it. Answer 'yes'.
-Close Excel
-Reopen Excel (do NOT manually register the DLL or re-create the DLL in VFP)
-Go into Tools/Add-ins, select [Automation], select Browse and manually find and select the DLL. (Apparently Excel registers it)
-Recalculate the worksheet and everything works fine.
If you close excel again, you'll have to repeat the steps above in order to be able to use the automation server's functions in your worksheet again.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement