powerpoint-vba

Creating and Accessing a OLEObject

匆匆过客 提交于 2019-12-12 02:39:19
问题 I have an VBA Macro that at times requires me to create a new slide with a new embedded excel spreadsheet, then edit that spreadsheet. A simplified version of this code: Dim sld As Slide Dim shp As shape Dim pptWorkbook As Object Set sld = ActivePresentation.slides.add(ActivePresentation.slides.Count + 1, ppLayoutBlank) Set shp = sld.Shapes.AddOLEObject(100, 100, 100, 100, "Excel.Sheet") DoEvents If shp.Type = msoEmbeddedOLEObject Then 'Error thrown here Set pptWorkbook = shp.OLEFormat.Object

Cannot ungroup a PowerPoint SmartArt Shape

家住魔仙堡 提交于 2019-12-12 01:58:39
问题 I try to ungroup a SmartArt shape from code, but it always causes an error: "This member can only be accessed for a group". However, it's working, if I right click on the SmartArt shape, and ungroup it. How can I fix this? My code is: public void CreateSmartArt(PowerPoint.Shapes allShapes) { PowerPoint.Shape smartartShape = allShapes.AddSmartArt(IttPowerPoint.Instance.PowerPointApp.SmartArtLayouts["MyLayOut"], 0f, 0f, width, height); Marshal.ReleaseComObject(smartartShape); smartartShape =

Save powerpoint presentation as as a pdf in vba

不羁岁月 提交于 2019-12-11 17:25:56
问题 I have looked at a lot of answers to this question but can't figure out what I have done wrong. I am trying to create a pdf file. I get my data from an excel file and copy it into powerpoint. I then try to save as pdf but it keeps giving me an error (object required) at the saving pdf section of the macro (see below). I tried changing it multiple times but still can't get it to work. Have attached code below. After I fix this problem, I need to be able to change the size of the object I

Powerpoint VBA Harvey Balls

别来无恙 提交于 2019-12-11 16:27:18
问题 I'm trying to create some Harvey balls from VBA code in PowerPoint 2010+. For this, I'm inserting a circle shape and a pie one and combine them. Everything works fine if I'm inserting the two shapes from the ribbon and then align and combine them, but when I'm inserting the shapes from VBA, the result of combining them is completely different and I don't understand why. So: insert shapes from ribbon -> align using ribbon -> combine using ribbon -> everything OK insert shapes from VBA -> align

Creating a Table out of .Values stored in an Array

杀马特。学长 韩版系。学妹 提交于 2019-12-11 15:12:44
问题 I'm new to working with 2D arrays, and would like to get better. Currently everything is going well, my array is populating like I want it to, but I can't figure out how to get it into a table. Right now I have each cell's value stored in it's corresponding array slot. So Range(B1:B4) is stored in IQRef(1, 2), IQRef(2, 2), IQRef(3, 2), IQRef(4, 2) . For what I'm doing, storing the Range directly is not an option. PowerPoint issues with pasting non-contiguous ranges... So what I want to be

Using IWebBrowser2 to put Widgets in PowerPoint — Automation Error: Unspecified Error

雨燕双飞 提交于 2019-12-11 13:56:16
问题 I created a simple macro to put an HTML widget from Weather.com in to a PowerPoint slide. It is not event-based, but ActionButtons call the ConnectWidget subroutine, when navigating to the slide. That's working fine, but you will notice that I have only been able to get this to work by first deleting the existing WebBrowser shape, and then re-creating it. I had to do this, ultimately, because any method call from wb after the .Navigate , I get an Automation Error/Unspecified Error, or Method

Weird bug on powerpoint vba

佐手、 提交于 2019-12-11 13:35:57
问题 I have a "mynote" textbox on a slide. If I execute: Sub test() If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then MsgBox "ok" End If end sub It works. But If I attach a shape with this macro: Sub test(oShape As Shape) If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then MsgBox "ok" End If end sub It doesn't work (no error message, no "ok" message) 回答1: It will depend on how you call it from another sub routine - you have to send in a shape. Like: Sub testYourTest

Export each slide of Powerpoint to a separate pdf file

吃可爱长大的小学妹 提交于 2019-12-11 12:41:54
问题 I need to generate for each slide of my presentation a pdf file. I'm using the following code: ActivePresentation.ExportAsFixedFormat ActivePresentation.Path & "\" & ActivePresentation.Name & ".pdf", ppFixedFormatTypePDF, ppFixedFormatIntentPrint This code works fine, but it exports all the slides into a unique pdf file. 回答1: You can do that: Below code will create pdf with adding the slide number at end of current folder, file name. Sub ExportSlidesToIndividualPDF() Dim oPPT As Presentation,

ProgressBar control cannot be load (Library not registered)

感情迁移 提交于 2019-12-11 12:12:39
问题 I am trying to add a progress bar to my User form but it is giving me "Library not registered" error. What I do is the following: First I add the progress bar to the toolbox from Tools -> Additional controls I choose the progressBar from Toolbox options and try to put it in the userForm It gives me the error: Apparently I have to add a Library from Tools -> References but I don't know which one is the one that is needed. I google it and I found that the MSCOMCTL.OCX could be the one that I

How to Differentiate SaveAs call and Save call in PowerPoint events?

佐手、 提交于 2019-12-11 12:11:12
问题 I'm writting AddIn for PowerPoint 2010. I'm using two functions of PowerPoint. Application_PresentationBeforeSave(ByVal Pres As Microsoft.Office.Interop.PowerPoint.Presentation, ByRef Cancel As Boolean) Application_PresentationSave(ByVal Pres As Microsoft.Office.Interop.PowerPoint.Presentation) When I perform Save operation (Ctrl+S) or SaveAs (File -> SaveAs) on powerpoint it executes Application_PresentationBeforeSave() method. But I need to differentiate these two calls (Ctril+S & SaveAs)