Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Automation Problems
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00861104
Message ID:
00861122
Vues:
29
Start simple and build from that!

A good place to start - and so you will "beleive" that it can work, would be to check out the sample in VFP Help.

Open the Help Dialog. Select the search Tab and enter "Excel". Select the second item, "Visual Foxpro Advanced COM".

The sample has a little VFP COM and provides the script to write the Excel side of the project (including instanciation of the VFP COM). AND - It works - one of my favorite VFP Help examples!

Have you fooled with the "Help" COM yet?

>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.
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform