powerpoint-vba

When to use TextFrame or TextFrame2 in VBA

霸气de小男生 提交于 2019-12-21 03:29:08
问题 Example, in Powerpoint: The TextFrame object: Represents the text frame in a Shape object. Contains the text in the text frame and the properties and methods that control the alignment and anchoring of the text frame. The TextFrame2 object: Represents the text frame in a Shape or ShapeRange object. Contains the text in the text frame and exposes properties and methods that control the alignment and anchoring of the text frame. So TextFrame2 also refers to ShapeRange object, and it has a few

Extracting an OLEObject (XML Document) from PowerPoint VBA

為{幸葍}努か 提交于 2019-12-20 07:47:33
问题 I am developing an application in VBA. Userforms connect to a COM object that reads an SPSS Statistics SAV file or an SPSS Dimensions MDD file. Part of this application stores metadata in an XML document so that we can retrieve the metadata later and repopulate or update the graphics created from the userforms. This works fine as long as we rely on an XML file existing on a local drive - which is not a desirable solution. We would prefer to embed (not link) the XML in to the PPTM file, which

Excel to PowerPoint PasteSpecial and Keep Source Formatting

六月ゝ 毕业季﹏ 提交于 2019-12-20 07:06:31
问题 I'm trying to copy and paste a range from an Excel document into a PowerPoint slide. It is copying the range as an image rather than keeping source formatting. oPPTApp As PowerPoint.Application Dim oPPTFile As PowerPoint.Presentation Dim oPPTShape As PowerPoint.Shape Dim oPPTSlide As PowerPoint.Slide On Error Resume Next Set XLApp = GetObject(, "Excel.Application") On Error GoTo 0 Windows("File1.xlsx").Activate Sheets("Sheet1").Select Range("B3:N9").Select Selection.Copy oPPTApp.ActiveWindow

Apply Font Formatting to PowerPoint Text Programmatically

放肆的年华 提交于 2019-12-19 19:47:25
问题 I am trying to use VBA to insert some text into a PowerPoint TextRange , I use something like this: ActiveWindow.Selection.SlideRange.Shapes("rec1").TextFrame.TextRange.Text = "Hi" However, I can't figure out how to apply bold, italic and underline programmatically (I don't see a .RichText property or something similar). What I have is some simple HTML text with bold, italic and underlined text I would like to convert over. How to do this? 回答1: This is easily accomplished by using the

Call subroutine when a specific slide loads, or on a timer

♀尐吖头ヾ 提交于 2019-12-19 08:40:11
问题 I'm working with a PowerPoint 2003 presentation for a kiosk display, and it is left running pretty much 24/7. One slide on it has the weather, the current date, and the 7 day forecast. I've already written the subs that will update the weather from an Excel workbook, and update the dates displayed, but right now I have to manually update it when I come in. Is there a way that I can have a subroutine (e.g. UpdateSlide() ) called when the slideshow reaches that particular slide? It seems like

Call subroutine when a specific slide loads, or on a timer

旧城冷巷雨未停 提交于 2019-12-19 08:40:09
问题 I'm working with a PowerPoint 2003 presentation for a kiosk display, and it is left running pretty much 24/7. One slide on it has the weather, the current date, and the 7 day forecast. I've already written the subs that will update the weather from an Excel workbook, and update the dates displayed, but right now I have to manually update it when I come in. Is there a way that I can have a subroutine (e.g. UpdateSlide() ) called when the slideshow reaches that particular slide? It seems like

Extracting comments from a PowerPoint presentation using VBA

这一生的挚爱 提交于 2019-12-19 03:25:17
问题 I have a PowerPoint which contains around 50 slides. Each slide might have 1 or more comments provided by the reviwer (done using insert->comment menu). I am trying to get the comments programatically exported into a text file using this VBA code: Sub ConvertComments() ''# Converts new-style comments to old Dim oSl As Slide Dim oSlides As Slides Dim oCom As Comment Set oSlides = ActivePresentation.Slides For Each oSl In oSlides For Each oCom In oSl.Comments ''# write the text to file : (oCom

PowerPoint VBA does not recognize Excel table during run

强颜欢笑 提交于 2019-12-18 09:04:32
问题 I have a peice of code which copies a range from my excel file and pastes it onto my activeslide in PowerPoint. After hours of attempts to get the range from excel pasted as a table (NOT an image), I found the below code to work successfully. Note: myPP = powerpoint application. myPP.CommandBars.ExecuteMso "PasteExcelTableSourceFormatting" myPP.CommandBars.ReleaseFocus The problem is that when I execute the macro, the table is pasted, but vba does not recognize the table unless the code is

How to obtain PowerPoint File Format Programmatically

ぐ巨炮叔叔 提交于 2019-12-18 07:11:19
问题 I need to determine whether the ActivePresentation is 97-2003 or 2007 format. I really won't want to check the extension. Is there a property somewhere inside the PowerPoint Object Model which gives this info? 回答1: There is no File Format property, unfortunately. You'll have to go the extention route, like: Sub APFileFormat() Dim ap As Presentation Set ap = ActivePresentation Length = Len(ap.Name) Match = InStrRev(StringCheck:=ap.Name, StringMatch:=".") ExtentionLength = Length - Match Select

Error Pasting Excel Chart into Powerpoint VBA

浪子不回头ぞ 提交于 2019-12-17 20:27:19
问题 I have the below Sub which is suppose to take a chart from excel and paste it into a newly created PowerPoint slide. It then exports the chart as a PNG: Sub ChartsToPowerPoint() Dim pptApp As PowerPoint.Application Dim pptPres As PowerPoint.Presentation Dim pptSlide As PowerPoint.Slide 'Open PowerPoint and create an invisible new presentation. Set pptApp = New PowerPoint.Application Set pptPres = pptApp.Presentations.Add(msoFalse) 'Set the charts and copy them to a new ppt slide Set objChart