Consulting

Results 1 to 6 of 6

Thread: Combining slides that have VBA Code (PP2010)

  1. #1
    VBAX Regular
    Joined
    Feb 2012
    Posts
    41
    Location

    Combining slides that have VBA Code (PP2010)

    I have a number of "template" slides, each of which has a VBA module instructing it how to update it's shapes, charts, etc. base on an Excel spreadsheet it can open and read. I want to combine these template slides into a single deck. I used the "NewSlide:reuse" command to insert the first slide behind the second. That worked great. Both slides were in the deck with their VBA modules intact. I then tried to do the same thing with another slide, expected its VBA code to come along with it. The slide was appended to the other two. However, the third slide's VBA module replaced the VBA module of the second slide. The second slide's module disappeared. Even worse, when I save the file with the three slides and then reopened it, only the VBA code from the first slide re-appears (although the other two slides--without their VBA code--were still part of the file. Is there any way to append a series of slides to one another so their VBA code comes along with them? Thanks.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Slides : Reuse does NOT import a module from the VBe. You would need to export the module from each presentation and then import to the new one. Make sure the modules have different names and in the VBE Project Explorer RIGHT Click > Export (or Import)
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    Feb 2012
    Posts
    41
    Location
    Great. Thanks once again John. I also figured out the line of code I can put into my "control slide" to import the models I will need:

    ActivePresentation.VBProject.VBComponents.Import("path + filename')

    It's nice having a program that can modify itself :-) Now, if I can just use an array to hold the Module names I need to call. If not, I suppose I can set up a look-up table with the "Select Case" structure to call the ones I need. Thanks again.

  4. #4
    VBAX Regular
    Joined
    Feb 2012
    Posts
    41
    Location
    So, to continue this conversation:

    I can write a line of VBA code to either "import" or "Export" a VBA module from a file (see previous post). But, for the life of me, I can't seem to construct a VBA statement that will "remove" a VBA module. Is there a way to do that?

  5. #5
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    [VBA]Sub modkill()
    Dim vbcomp As Object
    Set vbcomp = ActivePresentation.VBProject.VBComponents
    vbcomp.Remove VBComponent:= _
    vbcomp.Item("Module1")
    End Sub[/VBA]
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  6. #6
    VBAX Regular
    Joined
    Feb 2012
    Posts
    41
    Location
    Thanks yet again. I got all the way up to "remove" but then didn't know what "VBComponent as VBComponent" was trying to tell me that I needed the ":=" followed by the component with the complete objective definition (e.g., ActivePresentation.etc.). I'm not very clear on what the "parameter" hints mean when they pop up in the editor.

    Again, I really appreciate the help! What can I do for you? I doubt I can give you any programming tips! Does it help you if I keep going to your website to watch the free videos? I'm sure it would help me :-)

Posting Permissions

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