Consulting

Results 1 to 4 of 4

Thread: How to include forms and code modules into dozens of separate PPTs?

  1. #1

    How to include forms and code modules into dozens of separate PPTs?

    I have several dozen PPTs which I want to include various forms and code modules into. I created them in a development PPT but I need to use their code/forms in all the other PPTs.

    Does VBA have some kind of #include function that allows me to easily include code/forms from another PPT?

    Thank you.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    If you have exported the modules / forms you can import them using the IMPORT method

    ActivePresentation.VBProject.VBComponents.Import ("full path")

    You would need to go to Trust Center and enable access to the vb project as this is disabled by default
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    That worked *perfectly*. Thank you.

    One final thing... I created a button by manually inserting a shape (that looks like a button) then setting it's "action" to execute the main Sub code section. I keep this shape out of view until I need to run code, then I move it into the primary display area, run PPT in Reading View, which allows the button to serve as a VBA execute button. Is there a way to use VBA to generate this 'button' (with Action pointing to VBA code) if it doesn't already exist?
    Last edited by TrentLane; 02-19-2021 at 11:19 AM. Reason: added quotes

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Not sure if this is what you mean but should help ;

    Dim oshp As ShapeSet oshp = ActivePresentation.Slides(1).Shapes.AddShape _
    (Type:=msoShapeRectangle, Left:=10, Top:=10, Width:=200, Height:=100)
    With oshp.ActionSettings(ppMouseClick)
    .Action = ppActionRunMacro
    ' run macro named 'chex'
    .Run = "chex"
    End With
    Last edited by John Wilson; 02-20-2021 at 08:29 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •