How Do I Modify This To Fit My Specific Needs?Ĭhances are this post did not give you the exact answer you were looking for. If anyone has a better way of handling this or knows why this is happening please leave a comment so we can post the best solution in the article! Center Image To Middle Of The Slide
PASTE IN POWERPOINT KEEP SOURCE FORMATTING CODE
My "fix" was to try an execute both lines of code and ignore which ever line errors out. Likewise, in 2013 you can set a ShapeRange variable equal to the selected shape (a newly pasted shape is automatically selected), however in 2007/2010 you will receive an error. This however causes an error in Office 2013. In Office 20 you can set the variable on the same line as the PasteSpecial. NOTE: There seems to be some sort of bug when trying to set the shp variable to the recently pasted image. If you ever need to increase or decrease your array list (ie need to copy paste more or less data into your slides), this part of the code will never need to be changed because it is dynamically structured! By using the LBound (lower bound) and UBound (upper bound) functions, you can ensure that your loop statement cycle through the proper amount of times. This snippet of code ensures that you are looping through every single piece of data inside your arrays. Shp.Top = (.SlideHeight \ 2) - (shp.Height \ 2) Shp.Left = (.SlideWidth \ 2) - (shp.Width \ 2)
![paste in powerpoint keep source formatting paste in powerpoint keep source formatting](https://www.howtogeek.com/wp-content/uploads/2020/03/PowerPoint-Paste-Slides-Keep-Theme.png)
Set shp = myPresentation.Slides(MySlideArray(x)).Shapes.PasteSpecial(DataType:=2) 'Excel 2007-2010 Set myPresentation = PowerPointApp.ActivePresentation MsgBox "PowerPoint could not be found, aborting." 'Handle if the PowerPoint Application is not found MsgBox "PowerPoint Presentation is not open, aborting."
![paste in powerpoint keep source formatting paste in powerpoint keep source formatting](https://www.lifewire.com/thmb/mNmeUlijEt1sU25EX4dn6Njp2SA=/1920x1280/filters:fill(auto,1)/copyppslides-244e8bca04a748b5b1a82c27a2483227.jpg)
'If PowerPoint is not already open then Exit
![paste in powerpoint keep source formatting paste in powerpoint keep source formatting](https://thesoftwarepro.com/wp-content/uploads/2017/01/powerpoint-countdown-timer-paste-options-1.jpg)
Set PowerPointApp = GetObject(class:="PowerPoint.Application") 'PURPOSE: Copy Excel Ranges and Paste them into the Active PowerPoint presentation slides