Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add event to excel document
Message
De
09/07/2002 14:01:08
Charles Richard
Nvo Management Systems
Boisbriand, Québec, Canada
 
 
À
08/07/2002 08:57:02
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00675958
Message ID:
00676761
Vues:
25
Thanks alot.

I was able to add the code using .CodeModule.InsertLines method. Works fine!

Much appreciated
Charles Richard


>>I am creating an excel document through automation. I need to add code to the Worksheet_Change event. How can I do this from VFP 7?
>>
>>Recording a macro doesn't follow through to the VBA editor so I can't see how Excel does it)
>>
>
>The piece of the object model you need to examine is VBIDE and its VBComponents collection. I was able to find the code in a Word document with code along these lines:
>
>
>    LOCAL loComponent AS VBIDE.VBComponent
>
>    WITH THIS.odocument.VBProject
>      *************************************************************      * Grab the right module
>      *************************************************************      loComponent=.NULL.
>      FOR lnComponent = 1 TO .VBComponents.COUNT
>        IF UPPER(.VBComponents(lnComponent).NAME) == "THISDOCUMENT"
>          loComponent = .VBComponents(lnComponent)
>          EXIT
>        ENDIF
>      ENDFOR
>
>    ENDWITH
>
>    RETURN loComponent
>
>
>Once you get that far, you want to look at the CodeModule member of the component.
>
>It's pretty brute force, but I was able to replace the code in one document with code from another.
>
>Tamar
Charles Richard
NVO Management Systems
crichard@nvo.ca
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform