Is there an event to detect when the user duplicate a slide in PowerPoint?
PowerPoint doesn't fire a specific event when a slide is duplicated; there's just the event it fires when a new slide is added. If you can figure out a way to distinguish a duplicated slide from a newly added (or inserted) slide, that might help.
Since the duplicate will be directly after the original slide, you could compare, say, the number of shapes, type and position of each shape on the duplicate to the immediately preceding slide and if there's a match, it's a fair bet that it's a duplicate.
If you need to trap the event when a user Ctrl+Drags a slide to copy it to another location in a show, things get a bit more complex.
Chirag Dalal has a very useful page listing all of the events that PowerPoint supports and in which version of PPT they're supported:
http://www.officeoneonline.com/vba/events_version.html
Related
First time poster here! I am hoping someone can help me find a way to create a macro that would direct the powerpoint to advance to a certain section depending on the day/time. I have four sections (weekdayAM, weekdayPM, weekendAM, weekendPM) and a single slide at the start of the presentation with a textbox start button. Ideally, I would like to enable an onclick macro to direct to the appropriate section based on the day/time conditions.
Any ideas?
I am currently working on a macro that automatically imports images, charts,... into PowerPoint using VBA. To do so the file name of the image/chart that needs to be put on the slide is written in the placeholder as
<filename.png>
Whenever this text is changed by the user I want an event to be triggered that checks if the image with this name exists. If not I want to give out an error.
Now I have a problem with the events I use. I am currently using
WindowSelectionChange
which activates whenever I select anything on the slide. But after clicking on a placeholder containing the <...> the event is always triggered several times (at least 4 times) and I only wanted it to be triggered when the text in the placeholder is changed.
Does anyone have an idea how to solve this problem?
I know how to add smart art to the slide, but it always fills the slide. My customer wants to place the smart art automatically in certain places on the slide. I can't see how to trap the insert smartart dialog to get the smartart and place it myself on the slide. Does anyone have nay suggestions on how I might accomplish this? BTW, How to I find the mso code that I can put on my ribbon to invoke the insert smartart dialog?
One way would be to add an event handler, then trap the selection change event. When the selection changes, determine whether the current selection is a smart art shape. If so, look at the smart art shape's .Tags collection to see if it's been tagged. If so, leave it alone. If not, tag it and resize it.
Try SmartArtInsert (generally you can figure out the names if you go into PPT's Customize Ribbon dialog and hover the mouse pointer over the control you're interested in)
I'm working on a VBA macro to automatically add hyperlinks within a drawing file, so that when a certain word is mentioned in the text, I can link to another page in the drawing.
According to MSDN and Visio's help, a Hyperlink object can be associated with a cell, characters, row, or section object. However, I can't find any way to actually associate a hyperlink with anything but a shape.
So the question is, how can I hyperlink a single word within a paragraph of text in a single shape in Visio?
I'm only familiar with two ways to trigger a hyperlink navigation within Visio:
Add a Hyperlink to a shape and click on the shape (or select the hyperlink from the shape's context menu).
Add a call to the Hyperlink shapesheet function in a cell formula. Making a change that triggers that cell's recalc would then follow the hyperlink.
The best idea I can think of, and it isn't very good, is:
Make sure your shape is a group - if it isn't, convert it to group.
Change the group's properties to SelectMode=visGrpSelModeMembers1st and DisplayMode=visGrpDisModeBack.
Drop a new shape, sized and centered over the word in question. Make the new shape transparent (partial transparency here could be used for highlighting).
Change the DblClick event's formula to "Hyperlink("yourURLhere")".
Add that shape to the group.
Now, double-clicking on the word should actually involve double-clicking on the new subshape, which will trigger the hyperlink. This is really only viable if your shape is designed to work with this idea - many out-of-the-box shapes will not work well here, as steps 1 and 2 can have ugly side-effects.
I hope someone else knows a more elegant way around this problem.
i am developing a large non-linear powerpoint which has many sub sections to it. This has necessitated a table of contents slide (TOC). in this slide i am representing each section with its own picture. also on the slide are 2 buttons which let the user switch between images. The buttons do this by setting the appropriate section image to visible and all the others to invisible, so that only one sections image is visible at a time. my goal is to make sure that whenever the user goes back to the table of contents slide that the slide displays the same section image each time, regardless of which section what entered the previous time, i.e. the image for section 1 should be visible whenever the user goes back to the table of contents. how do i go about doing this?
also, if i can find new sources to learn more about syntax and other vba coding, i would be most appreciative.
i already consult:
pptalchemy.co.uk
skp.mvps.org
msdn.microsoft.com
i just cannot find more good sites that will help.
I don't quite understand the situation, but one possibility:
Add another slide before the TOC. You could make it a duplicate of the TOC slide (with the image you want in place).
Instead of linking back to the "real" TOC slide, link to this one instead.
On this slide, add a rectangle that covers the entire slide, make it 99% transparent and give it a Run Macro mouse over action setting.
Have the macro do nothing more than set the image you want on slide 2 to be visible, then jump to slide 2 (the real TOC slide), eg
SlideShowWindows(1).View.GoToSlide(2)
The mouse over macro will trigger as soon as the user moves the mouse, and since that will trigger a jump from one slide to an identical one, it will be invisible to the user.
most of the solution came from [pptalchemy] (http://www.pptalchemy.co.uk/PowerPoint_Auto_Open_Code.html):
I downloaded the custom ui editor for microsoft office
I added the code from ppt alchemy to the custom ui editor for the slide show.
In vba i added the code:
Sub onloadcode()
Debug.Print "Running"
End Sub
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = SSW.Presentation.Slides("TOC").SlideIndex Then
'code here'
end if
end sub
the code executes perfectly now, and i have condensed my table of contents from 9 slides down to 1. Just, don't add features to the code until you have everything in place to accept them. In my case i added the code for text boxes which did not exist yet and that messed up my code a lot. Once i made all of the objects for the code and then added the code it worked perfectly.