Solved

PowerPoint macro unintentionally disables all menu commands?

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
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…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

776 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