I refer specifically to the 2016 version, but this should also apply to 2013 and 2010.
----- TLDR Summary
Is it possible to use VBA to add a new Slide Master using a method
that I haven't found?
Is it possible to use VBA to access or manipulate the Layouts of
Slide Masters other than the first one in a Presentation object?
I suspect that the answer to both is "No" and that MS has merely
screwed up the exposure of the underlying objects, but others may
know more about programming PPT than me.
------ The Whole Question
Microsoft has deemed PowerPoint unworthy of a macro recorder for lo these many versions (I think it was dropped in either 2003 or 2007 from memory), so no help can be obtained from there.
The linked MSDN "help" item is woeful. It states that the property returns a Master object, though that isn't relevant for the moment.
An Office support page describes a slide master here. A Slide Master seems to be where the presentation's Slide Layouts live, presumably in the SlideMaster's CustomLayouts property, though it's interesting to note that only the first 9 of those CustomLayouts correspond to what you see in the GUI. (I count 11 CustomLayout objects in the SlideMaster in a new, blank presentation.) The numbers change if you add new layouts though the two vertical text layouts never seem to appear in the GUI list. This too is not the problem.
The problem is that you can in fact have more than one Slide Master per presentation by going to the View menu, Slide Master, and then selecting Insert Slide Master. Having multiple Slide Masters is discussed on the Office Support site here.
Frankly I regard this functionality as slightly broken because if you do that, then apply a Theme to the new Slide Master, you end up with a third Slide Master; the original under "Office Theme", a second under "Custom Design", and a third under the name of the Theme that you applied. This too is not in itself a problem. (Though it's worth noting that a Presentation does not have an AddSlideMaster method, which means that it does not seem to be possible to do this by VBA. Not that you necessarily want to, but if you did, you can't. There is only an .AddTitleMaster method which seems to be useless since all presentations have a TitleMaster as far as I can see and if a presentation has one then that method will error out according to the documentation.)
The problem is that the Presentation object does not have a collection of Slide Masters. It has only that one property, SlideMaster, which returns a single Slide Master / Master object.
Accordingly I can't see any way that you can programmatically add a new Slide Master. And even if you used one that is added through the GUI you can't seem to access any Slide Master except for the first one. And therefore you don't seem to be able to access, manipulate or assign any Layout from any Slide Master other than the first one to an individual slide.
Am I correct in this assumption, or am I missing something?
I shall offer thanks in advance even though that is often deleted from questions. Not that this one is likely to attract much attention; I suspect that there may be another Tumbleweed badge in my future.
Perhaps this page will be helpful in understanding it better - http://skp.mvps.org/2007/ppt003.htm
Related
I'm building a PowerPoint VSTO addin where I store a lot of metadata on the presentation.
I'm currently storing it as XML as either manipulating AddIn.Application.ActivePresentation.CustomXMLParts for global data and Slide.CustomerData for slide specific information.
The problem is that neither of them is represented on the Undo/Redo stack. I can make a quintrillion changes to the presentation and modify my Custom XML at the middle somewhere, undo everything and still read back the XML I have last set.
Since I want my modifications to be Undo/Redoable, the best I could think of is storing the XML on a Shape and delete+recreate it on every modification. The problem with this is that the user can obliviously delete the shape or the slide the shape is stored on.
I need something less visible (to prevent accidental removal) and - preferably global - object on the presentation that I can store my XML on that is deletable/recreatable and modifies that Undo/Redo stack.
Is there something like this?
Or is there a better way to do this?
To answer my own question:
There is Tags!
When you add something to it with Tags.Add("Name", "Value") it is properly undoable, unlike CustomerData or CustomXMLParts.
Tags is present on the presentation and on the slides so both of my scenarios are covered.
My company creates workbooks for clients that contain ActiveX controls (in most cases we need the extra functionality as compared to Form Controls). When we create them, they work fine on our end, but when we zip them up and send them to our clients, they open the WB and the ActiveX controls are no longer ActiveX controls, if you right click it, it behaves like a picture.
I feel like this is due to the MS ActiveX debacle. I have had them run the Fix It and making sure all the MS Office components were closed, and had them reboot, but still nothing.
I am pulling out my hair, and have asked on other forums if anyone else has had this issue, and what they have done to fix it. Thanks in advance.
Could you please check in client system whether macros and active x controls are enabled in Trust center setting?
https://support.office.microsoft.com/en-us/article/Enable-or-disable-macros-in-Office-documents-7b4fdd2e-174f-47e2-9611-9efe4f860b12?CorrelationId=fe6a4d24-f4d9-4c6b-afa0-40d2828ad22e&ui=en-US&rs=en-US&ad=US
use above link if needed.
Try closing excel and deleting the .EXD files from your computer.
Source: http://www.mrexcel.com/forum/excel-questions/296750-command-button-turned-into-image.html
While saving the Excel document, save it as "Macro enabled workbook".xlsm
In my case, the worksheet prompts a non responsive error sometimes. When I reopen it, Excel repairs it and turns all active X check boxes (sometimes drop down list and command buttons) into images. It happened many times and I had to spend a lot of my time recreating them and liking to cells.
I experienced a similar problem when Excel repaired a file; this may be similar to what's happening with the Zipped file. FormControl Buttons don't appear to have the same problems but I see you want to keep the additional functionality of the ActiveX Control.
You may be able to make use of the code I created by inserting one Form Control button that runs the Sub RepairMissingButtons() that your clients can press to restore the images to CommandButtons. This currently fixes buttons for any selected sheets, so you'd want to first identify which sheets need to be selected (or add a form control button on each sheet that needs the repair done).
You'd need to modify the Sub CreateButton() to meet your needs (currently requires hard-coding the Caption, BackColor and any other ActiveX properties that may have been lost by the button being converted to an image):
Reverse Excel ActiveX command buttons erroneously converted to images after corrupted file repair
Having this problem, activex controls sometimes change to pictures.
Many places around the internet the answer is: Use form controls, well as far as I can tell form controls don't actually do anything useful.
Even Microsoft's support site says, recommend using form controls, how can that be the answer. being able to interact with VBA is as far as I can tell the only reason to use Microsoft applications instead of free ones.
Let me explain the context:
I have a huge training material (some 750 slides, for a two-days training) to rework.
Even though it is considered a "in-depth training", not all the material is useful for a given two-days session. Depending on the trainees profile, a chapter can either be fully presented with practical advices, or only the overview is given.
This means, before every session, I review the material and manually select which slides will be presented/hidden according to the trainees profile.
As I've never used VBA macros on Powerpoint, I was wondering if it is possible to, say, "tag" the slides with one or several roles (e.g. slide for "system designer", slide for "certification specialist", slide for "system designer + certification manager", etc...), and then by a simple form, check the "tags" you want and automatically generate the related presentation with the tagged slides accordingly.
For example, if for a given training session I have no system designer, but I have certification specialists and managers, I will check "certification specialist" and "certification manager" and it will generate me the presentation with only the slides that have those tags.
I hope I was clear enough...
Many thanks in advance !
Morgan
Yes, this would be possible. Using VBA, you could tag the slides (there actually ARE things called tags in the object model), then have a routine make any slides tagged a certain way visible and all others invisible.
To add a tag to the currently selected slide, you'd do something like this to identify all of the currently selected slides as being material for Certification Specialists. Slides can have multiple tags, so you can mod the same code to make it tag them for the other types of audience as well.
Sub TagAsCertificationSpecialist()
Dim x As Long
For x = 1 To ActiveWindow.Selection.SlideRange.Count
ActiveWindow.Selection.SlideRange(x).Tags.Add "CertificationSpecialist", "YES"
Next
End Sub
Is it possible to programmatically change the selected master within a specific stencil document in Visio, using VBA? If so, how would I go about doing it?
It doesn't seem possible to use the Window.Select method, since that seems to only work in the drawing page...
With Visio API only it is only possible to get selected master(s) using the Window.SelectedMasters property, but not set it (it is a readonly property).
So, there is no direct solution.
If you are okay with (sort of) workaround, you can take a look at mine here (the same question):
http://visguy.com/vgforum/index.php?topic=3378.msg13172#msg13172
It simply sends keyboard keys to the stencil window right number of times :)
Is there a way to setup a series of PowerPoint presentations, say in the same folder, then setup one master powerpoint that when presented will import the slides in the folder to form one slideshow?
We, like many offices have slides that need to be updated by about a dozen people in the same hour, and I'm wondering if there isn't an easier way to just separate the slides out physically, then present them together logically without any manual overhead, since this isn't a very technically minded group.
I can't seem to find the right search terms for what I want to do, but I did try googling first :).
You can do this programmatically, as in:
Sub InsertOtherDecks()
Dim x As Presentation
Set x = ActivePresentation
x.Slides.InsertFromFile ("myslidedeck.pptx")
End Sub
You can also certainly do this via the client, but depending how much you need this and the control required Slides.InserFromFile offers easier control over inserting from many different decks. But here's the manual version: