Solved

PowerPoint macro unintentionally disables all menu commands?

Posted on 2014-04-02
3
478 Views
Last Modified: 2014-04-03
I've built an add-in for PowerPoint 2010.  One particular macro performs as expected, but when it is finished, my entire PowerPoint menu is disabled, not only my custom menu tab with my own macro buttons, but the entire menu.  I have to quit and re-launch PowerPoint to regain control.  

Can anybody see what may be causing this?

The macro creates a new layout for a custom type of slide, then opens a single-slide deck containing a few icons I need for this new layout, copies and pastes them to the layout I am building, closes the icon source deck, then creates a new slide based on the new layout just added.  I can navigate my new slide, add text, etc., but all menu commands are disabled.  They aren't greyed out.  The look normal, but I can't click on any of them.

Thanks for your help.

Sub add3colsnumb(ByVal mastno As Integer)

Dim myshp As Shape
Dim currentslide As Integer
Dim x As Integer
Dim dotbox As Shape
Dim layoutcount As Integer
Dim newslide As Slide
Dim newlayout As CustomLayout
Dim gridiconslide As Slide
Dim gridicondeck As Presentation
Dim gridiconaddress As String

If contentlibraryfolder = "" Then Call getcontentlibraryfolder
If contentlibraryfolder = "" Then DesignateFoldersForm.Show
If contentlibraryfolder = "" Then Exit Sub

layoutcount = ActivePresentation.Designs(mastno).SlideMaster.CustomLayouts.count

Set newlayout = ActivePresentation.Designs(mastno).SlideMaster.CustomLayouts.add(layoutcount + 1)

newlayout.Name = "Grid_" & Date & "_" & Time

Call AddHorizLine(newlayout, 33.08205, 239.0915, 266.1589, 239.0915)
Call AddHorizLine(newlayout, 284.2037, 239.0915, 517.2805, 239.0915)
Call AddHorizLine(newlayout, 535.3254, 239.0915, 768.4022, 239.0915)
Call AddTextBox(newlayout, 33.87315, 258.6399, 235.2491, 224.8062, "Lucida Sans", "16", 0, 1, 1, 3, "Click to add text")
Call AddTextBox(newlayout, 284.7016, 258.6399, 235.2491, 224.8062, "Lucida Sans", "16", 0, 1, 1, 3, "Click to add text")
Call AddTextBox(newlayout, 535.5301, 258.6399, 235.2491, 224.8062, "Lucida Sans", "16", 0, 1, 1, 3, "Click to add text")

gridiconaddress = contentlibraryfolder & "\Decks\gridicons-green.pptx"
Set gridicondeck = Application.Presentations.Open(gridiconaddress)
Set gridiconslide = gridicondeck.Slides(1)
    gridiconslide.Shapes("No13").Copy
        newlayout.Shapes.Paste
    gridiconslide.Shapes("No23").Copy
        newlayout.Shapes.Paste
    gridiconslide.Shapes("No33").Copy
        newlayout.Shapes.Paste
gridicondeck.Close

Call makesureslideselected

currentslide = ActiveWindow.View.Slide.SlideIndex

Set newslide = ActivePresentation.Slides.AddSlide(currentslide + 1, newlayout)

newslide.Select

End Sub

Open in new window

0
Comment
Question by:versatilebb
  • 2
3 Comments
 

Author Comment

by:versatilebb
Comment Utility
A bit more info:

If I toggle to another running program on my machine, then back to PowerPoint, I regain functionality of the ribbon, but next time I run any macro that creates a dialog box, I can't close it and am stuck again.  Have to force quite PowerPoint to get out of it.  

I know my trouble is coming in the part of the code where I open the second presentation and copy paste from it.  Works fine without that section which I just added yesterday.
0
 
LVL 23

Accepted Solution

by:
JSRWilson earned 500 total points
Comment Utility
You might want to post the code that is called by this code.

makesureslideselected
AddHorizLine
AddTextBox

and especially:

getcontentlibraryfolder
DesignateFoldersForm.Show (any initialize code)

better still post the whole pptm file
0
 

Author Comment

by:versatilebb
Comment Utility
JSR:

Thanks for chiming in.  I forgot to mention the most important fact, which is that I call this subroutine from within an open dialog box.  That seems to be why it is hanging up.  I changed my code to unload the dialog first, then call this sub, and it returns user control without any problems.  It doesn't answer why this happens, because as I said it works fine without the copy/paste section.  Without that, I can add slide after slide from within the dialog, then shut it when I want.  If you have other ideas, I'd be curious, but I'm out of time on this so I'll go with my solution and call this closed and give you the points.

I'd prefer not to post my whole file, but thanks for the reminder that you need all the pieces to unravel the mystery.  Thanks.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Setting the Scene Animations in PowerPoint are a great tool to convey messages when used carefuly with the content of your slides. There are plenty of animation effects and options, including a Repeat feature for individual animation effects. …
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now