Solved

PowerPoint macro unintentionally disables all menu commands?

Posted on 2014-04-02
3
485 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
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…

910 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

22 Experts available now in Live!

Get 1:1 Help Now