Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add event to excel document
Message
From
09/07/2002 14:01:08
Charles Richard
Nvo Management Systems
Boisbriand, Quebec, Canada
 
 
To
08/07/2002 08:57:02
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00675958
Message ID:
00676761
Views:
26
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
Previous
Reply
Map
View

Click here to load this message in the networking platform