powerpoint-vba

Change Shape color in a loop VBA PPT

孤街浪徒 提交于 2019-12-11 10:35:11
问题 I need to change Colors of certain Shapes in a slide, based on the criteria if the shape is an EndConnectedShape of certain Connectors (the connectors are selected based on some data in a .txt file, but the data input part works fine). Although it must be straightforward, the part where I try to get the Shape by its Name is still not working: Sub test() Dim oFSO As FileSystemObject Set oFSO = New FileSystemObject Dim oFS As TextStream Dim i, j As Long Dim filePath, smth As String filePath =

How to update PowerPoint chart using c#

与世无争的帅哥 提交于 2019-12-11 10:27:03
问题 I have to update pptx file. In this pptx i have some set of chart which i have to update the data through c# code. Please let us know how to do it? Note: It is not OLE graph, it is power point chart component Thanks in advance 回答1: In VBA syntax it's something like For i = 1 To ActiveWindow.Selection.ShapeRange.Count If ActiveWindow.Selection.ShapeRange(i).Type = msoChart Then Dim c As Chart Set c = ActiveWindow.Selection.ShapeRange(i).Chart Dim data As ChartData Set data = c.ChartData data

Detect text language in VBA

拈花ヽ惹草 提交于 2019-12-11 10:18:11
问题 I have a textbox in PowerPoint which I store into an array with Split. Is there any way to detect what language the text is in VBA? There will actually only be English or Chinese text, so I guess an alternative solution would be to detect if the text is not English, or is/isn't Unicode? 回答1: It should be possible by checking that one of the characters is Chinese: Function IsChiness(text As String) As Boolean Dim c&, i& For i = 1 To Len(text) c = AscW(Mid$(text, i, 1)) If c >= &H4E00& And c <=

Textbox with rounded corners using VBA

让人想犯罪 __ 提交于 2019-12-11 09:19:29
问题 I have a predefined textbox in a PowerPoint slide, I need to make its corners rounded. Is there any way I can do this using VBA? 回答1: This example assumes that the shape you're after is the third shape on slide 1. Adjust accordingly: Sub Test() Dim oSh As Shape Set oSh = ActivePresentation.Slides(1).Shapes(3) With oSh .AutoShapeType = msoShapeRoundedRectangle .Adjustments(1) = 0.25 End With End Sub It converts the textbox to a rounded rectangle then sets the corners to be rounded. As far as I

Adding PowerPoint animations via vbscript always results in “Custom” animation

好久不见. 提交于 2019-12-11 09:19:09
问题 Using vbscript I'm attempting to automate the creation of a PowerPoint presentation. The reason for it is that I have a folder with several dozens of png images which I need to insert into the same slide at the same position. They're all transparent and form one large image. However, I need to show one after the other until the full image is revealed. So instead of doing it by hand I came up with the following vbscript: Set powerPointApp = CreateObject("PowerPoint.Application") Set fileSystem

Macro to convert equations into images in Powerpoint 2010

南笙酒味 提交于 2019-12-11 08:34:34
问题 I am trying to preapre a macro that would convert all equations in a PowerPoint2010 presentation into images while retaining the position and animation effect/order. Based on the tip provided here (thanks to Steve Rindsberg), I have modified the script as below: Sub ConvertAllShapesToPic() Dim oSl As Slide Dim oSh As Shape On Error Resume Next For Each oSl In ActivePresentation.Slides For Each oSh In oSl.Shapes ' modify the following depending on what you want to ' convert Select Case oSh

Run an Excel Macro to Update a Powerpoint Linked Chart (Workbook Already Open)

拟墨画扇 提交于 2019-12-11 07:19:09
问题 Updated & cross-posted from: http://www.ozgrid.com/forum/showthread.php?t=203827 My objective is to run an Excel macro from within PowerPoint. [All the macro does is change the row filtering for a data range in Excel, thus changing lines depicted on a chart]. So my PPT macro should (1) run the Excel macro which changes the chart, and then (2) update that chart in PPT which is linked to the Excel chart. Here’s what I’ve tried: Sub Test() Excel.Application.Run "'" & "C:\myPath\" & "PPT Macro

find number from text in powerpoint using vba?

痞子三分冷 提交于 2019-12-11 06:41:59
问题 I know this question is already ask but here is some different scenario. So i wants to search integer from whole textarea. If found then check is it have decimals number more than 2 ( e.g. if numberfound=13.656 then round off to 13.66 ) if no then round off it. so if in one textarea there is more than one integer then it should check all of those. As i try to write code for finding specific character or number. but i am not getting it how to find whole integer(means no from 0 To 9). Below is

Return Array in Self-Calling Function in VBA

China☆狼群 提交于 2019-12-11 04:55:39
问题 I am trying to figure out how to return a string array in a function that calls itself. It is a function that looks through all folders and subfolders within a specific path to generate a list of text files and where they are located. Right now, the subroutine is All_Folder . I have previously tried making All_Folder a function, and trying to return the value from the function, but that has gotten me nowhere. This is my code now: Public file_locations() As String Sub Some_Subroutine() Dim

How to open Powerpoint using VBA

亡梦爱人 提交于 2019-12-11 03:57:54
问题 I am trying to open a PowerPoint file through Excel VBA. I get run-time error -2147467259 (80004005) method 'open' of object 'Presentation Failed' This is the code Sub createPPT(data As Workbook, ByVal pptpath As String) Dim Sh As Shape Dim PP As Object Dim PPpres As Object 'Create a PP application and make it visible Set PP = New PowerPoint.Application PP.Visible = msoCTrue Set PPpres = PP.Presentations.Open(pptpath) Set Sh = data.Worksheets("Overall_Role").Shapes("Chart 3") Sh.Copy PPpres