Solved

PowerPoint macro unintentionally disables all menu commands?

Posted on 2014-04-02
3
489 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
ID: 39974621
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
ID: 39976174
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
ID: 39977074
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
PowerPoint is the go-to presentation software for millions of users around the world. Many presentations use basic text features but you can really make special text jump out of your slide by applying this bubble text design process. This article ha…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

860 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