powerpoint-vba

How to name an object within a PowerPoint slide?

我怕爱的太早我们不能终老 提交于 2019-11-28 05:15:12
So I know how to name a textbox, or a like object in PowerPoint with VB, but I was wondering if there was a way to name objects through the Ribbon (PowerPoint 2007). For instance, if I add a text box onto a slide, is there a way to assign it a name (sort of like the properties window in access, or the textbox in Excel 2003 at the top left side where you can enter the name)? Basically so I can reference it in code later; without having to use code to name each and every object i add after the fact. Perhaps an easier way through the Ribbon? Todd Main Yes. Click on the object (textbox, shape, etc

Customizing the PowerPoint Ribbon at Run-Time

和自甴很熟 提交于 2019-11-28 04:41:28
问题 I am developing a PowerPoint add-in and would like to temporarily disable some of the Ribbon controls while the add-in application is running . I have developed a solution that works as expected when the Add-In is enabled , but this is not really adequate, because it disables some commonly used controls, like SlideMaster, SlideSorter, etc. I am using PowerPoint 2010. Here is a sample XML which is well-formed: <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon

Update PowerPoint chart without opening chart workbook or making it invisible

断了今生、忘了曾经 提交于 2019-11-28 01:44:14
Sub OO() Dim oPPApp As Object, oPPPrsn As Object, oPPSlide As Object Dim oPPShape As Object Dim FlName As String '~~> Change this to the relevant file FlName = "C:\Users\lich_\Documents\test.pptx" '~~> Establish an PowerPoint application object On Error Resume Next Set oPPApp = GetObject(, "PowerPoint.Application") If Err.Number <> 0 Then Set oPPApp = CreateObject("PowerPoint.Application") End If Err.Clear On Error GoTo 0 oPPApp.Visible = True Set oPPPrsn = oPPApp.Presentations.Open(FlName, WithWindow:=msoFalse) Set oPPSlide = oPPPrsn.Slides(2) With oPPSlide.Shapes("Chart1").Chart.ChartData

How to apply particular layout in powerpoint using vba?

你说的曾经没有我的故事 提交于 2019-11-27 23:12:23
I am working on one project. In that I made one custom theme which includes one master slide and may layouts. so basically i want to apply particular layout to specific slides. So is there any way to do it by programmatically. like : activepresentation.Slides(1).Layout="layoutname" I know above code is wrong but i want something like this to call particular layout by its name. for your information my layout name is "Title without Client Logo". Thanks ActivePresentation.Slides(1).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(x) where x is the index into the layouts

Get shape by Id or Name

两盒软妹~` 提交于 2019-11-27 08:04:21
问题 Is there any way to get a shape if you know its Id ? For example: Dim myshape As Shape myshape.Id = 42 myshape = getShapeById(myshape.Id) Or, alternatively, could I get the shape by Name ? Dim myshape As Shape myshape.Name = "Rectangle 42" myshape = getShapeByName(myshape.Name) 回答1: Getting a shape .Name by its .Id is somewhat more convoluted than getting its .Id by its .Name. But here's how it's done: Sub PrintShapeName() Debug.Print getNameByID(3, 1) End Sub Function getNameByID(shapeID As

How to populate an array from text file in Visual Basic for PowerPoint 2010

杀马特。学长 韩版系。学妹 提交于 2019-11-27 07:24:55
问题 I'd like to define an array like: sample_array = Array( _ "foo", _ "bar", _ ... "dog", _ "cat" _ ) ...in a macro written in VB for Applications (PowerPoint 2010 in this case), but I need to define the array from a text file that would just be formatted like: foo bar ... dog cat What is the simplest way to define a text file path and read the values (assume they are always regular ascii strings) directly into an array? Thanks! 回答1: Dim arr() as String dim i as Integer i=0 Open "c:\test.txt"

Extracting all text from a powerpoint file in VBA

China☆狼群 提交于 2019-11-27 07:10:16
问题 I have a huge set of powerpoint files from which I want to extract all the text and just lump it all into one big text file. Each source (PPT) file has multiple pages (slides). I do not care about formatting - only the words. I could do this manually with a file by just ^A ^C in PPT, followed by ^V in notepad; then page down in the PPT, and repeat for each slide in the powerpoint. (Too bad I can't just do a ^A that would grab EVERYTHING ... then I could use sendkey to copy / paste) But there

How to get Ribbon custom Tabs IDs?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 02:53:48
问题 I am working with a Custom Ribbon in Power Point, I need to iterate through all tabs and get the ID of them. The Ribbon contains Tabs added from different projects (C++, C#) as addins and I don't know their IDs. I am using VBA to handle the events fired from the Ribbon. How do I do to get the ID from all tabs in the Ribbon using VBA? Thanks in advance. 回答1: The Ribbon is accessed using CommandBars("Ribbon") which returns an IAccessible object. You access tabs by using AccessibleChildren _ Lib

How to update excel embedded charts in powerpoint?

百般思念 提交于 2019-11-27 02:51:45
问题 I have 30 charts that were created from excel and were pasted onto powerpoint slides. Every month, I have to update these 30 embedded charts by manually clicking on the charts and edit. I am aware there is an option to use paste special, so that the data in the charts can be updated automatically by clicking the update links. However, my charts needs to be edited by some users. Paste special option does not allow users to edit the charts. Hence, I am unable to use this paste special option. I

How to name an object within a PowerPoint slide?

让人想犯罪 __ 提交于 2019-11-27 00:42:02
问题 So I know how to name a textbox, or a like object in PowerPoint with VB, but I was wondering if there was a way to name objects through the Ribbon (PowerPoint 2007). For instance, if I add a text box onto a slide, is there a way to assign it a name (sort of like the properties window in access, or the textbox in Excel 2003 at the top left side where you can enter the name)? Basically so I can reference it in code later; without having to use code to name each and every object i add after the