powerpoint-vba

How to simulate ThisPresentation in PowerPoint VBA

我是研究僧i 提交于 2020-06-27 10:51:28
问题 I would like to be able to access the document properties of a PowerPoint add-in file (a presentation saved as "PowerPoint Add-in (*.ppa)", from some VBA code in the add-in itself. If it helps to understand the problem, what I'm actually trying to do is read a custom document property that stores the version number of the add-in, so that I can display that in a dialog box. With Word & Excel I can do this using ThisDocument & ThisWorkbook , both of which return a reference to the document

How do i check whether a File exists using VBA Macro in Powerpoint

此生再无相见时 提交于 2020-06-18 22:10:48
问题 I want to check if a file already exist before running my code. If it exists than exit otherwise keep my code running. What I wrote is following code: Private Sub CommandButton21_Click() If FileFolderExists("C:\Users\Moez\Desktop\Macro_Project\Test1.pptm") Then MsgBox "Modification already done!" Else deleteTextBox AllBlackAndDate LastModifiedDate SaveAllPresentations "C:\Users\Moez\Desktop\Macro_Project\Test1.pptm" ' save here End If End Sub 回答1: If you want to check a file exists on the

Copy data from powerpoint textbox to Excel cell

两盒软妹~` 提交于 2020-06-18 09:25:49
问题 I am using macro in MS Excel to import data from textbox in PowerPoint to Excel. It's importing data in text format not able to copy new line characters from textbox Range("a1").Value = pps.Shapes("textbox 1").TextFrame.TextRange.Text Can anyone please suggest alternative solution? 回答1: Recent versions of PowerPoint use Chr$(11) as a linebreak character. It looks like Excel wants a linefeed Chr$(10), so something like this: Range("a1").Value = Replace(pps.Shapes("textbox 1").TextFrame

How to crop an image with VBA to a specific form e.g. circle in PowerPoint?

爱⌒轻易说出口 提交于 2020-06-01 06:32:08
问题 I would like to crop a square image shape in PowerPoint with VBA to a specific form e.g. a circle. With Shape.PictureFormat there are only these options: .CropBottom .CropLeft .CropRight .CropTop Can someone help me with this question? Thanks! Moe 回答1: From Microsoft Community - you can use Shape.AutoShapeType to "crop to shape." Sub CropToCircle() Dim shp As Shape Set shp = ActivePresentation.Slides(1).Shapes(1) If shp.Type = msoLinkedPicture Or shp.Type = msoPicture Then shp.AutoShapeType =

How to crop an image with VBA to a specific form e.g. circle in PowerPoint?

試著忘記壹切 提交于 2020-06-01 06:32:05
问题 I would like to crop a square image shape in PowerPoint with VBA to a specific form e.g. a circle. With Shape.PictureFormat there are only these options: .CropBottom .CropLeft .CropRight .CropTop Can someone help me with this question? Thanks! Moe 回答1: From Microsoft Community - you can use Shape.AutoShapeType to "crop to shape." Sub CropToCircle() Dim shp As Shape Set shp = ActivePresentation.Slides(1).Shapes(1) If shp.Type = msoLinkedPicture Or shp.Type = msoPicture Then shp.AutoShapeType =

Add audio clip via VBA to PowerPoint Presentation that spans multiple slides

ⅰ亾dé卋堺 提交于 2020-05-27 06:47:27
问题 To play an audio clip inserted as a shape across multiple slides in a presentation, there is an option in the Play Sound dialog in the Effect tab called Stop playing and this can be set to After __ slides . I've browsed the object model and even attempted recording a macro using ppt 2003 (the option does not record). How (if it can) can this option be set via VBA ? The way I'm currently adding a sound (that stops after the slides are advanced) is: Dim oSlide As Slide Dim oShp As Shape Dim

Why does a countdown timer freeze when placed in SlideMaster?

被刻印的时光 ゝ 提交于 2020-05-14 18:22:07
问题 I used the following code to have a Countdown which would span over 10 slides whilst in slideshow mode. I placed the shapes in a SlideMaster Layout. Set QS = ActivePresentation.Designs(2).SlideMaster.CustomLayouts(2) Dim Seconds As Integer Seconds = 30 QS.Shapes("Counter").TextFrame.TextRange = Seconds For i = 1 To 30 Dim WAIT As Double WAIT = Timer While Timer < WAIT + 1 DoEvents Wend Seconds = Seconds - 1 QS.Shapes("Counter").TextFrame.TextRange = Seconds Next i Dim time As Date Dim count

Add a shape to a slide and format that

会有一股神秘感。 提交于 2020-04-30 07:36:17
问题 I am trying to make my vba script below to add annotation notes to powerpoint slides. The idea is that the script can be used to add "to-be-checked notes" to slides. Hence, I've got it set up in a little add-in that displays a menu so adding the TBC, TBU, TBD notes are added. The sub is showing errors from time to time and does not always fully do its job (i guess because of the part where I wrote in my code: ActiveWindow.Selection.SlideRange.Shapes("Rectangle 4").Select Can anyone assist me

Replacing one slide in several open presentations

拜拜、爱过 提交于 2020-03-05 06:07:29
问题 I cobbled together some VBA code in the hopes of replacing a single, identical slide in several open presentations. This pasted the new slide at the end rather than where the old slide was deleted. Also, I'd need this to happen with all open presentations. Note that I identify slides by SlideID. Sub ReplaceOneSlide() ActivePresentation.Slides.FindBySlideID(1846).Delete Dim sourcePresentation As Presentation On Error Resume Next Set sourcePresentation = Application.Presentations("X:\Marketing

Windows keyboard hook API in VBA causes infinite loop in PowerPoint

匆匆过客 提交于 2020-03-05 02:52:49
问题 I've built a simple VBA module to set a keyboard hook and a corresponding procedure to detect a pre-defined key combination (ctrl+3). It works perfectly except that when a user tries types in a window of the hosting app (PowerPoint), the code runs into an infinite loop causing the app to hang/crash. Here is the complete module with reproduction instructions: ' =========================================================================== ' Module : MOD_Keyboard_Shortcuts ' Purpose : Create pre