1 Attachment(s)
vba selective copying and pasting on the same powerpoint slide
Using copy and Paste to another position on the same slide during presentation
Good day,
I hope what I am trying to do is possible in PowerPoint.
I have a series of shapes and images in a line at the top of a slide.
When I click on any of the shapes or images, that specific shape or image must be copied and pasted in a next line on the same slide, starting from the left. When I click on a second shape or image, that shape or image must be copied and pasted next to the previous one, and so on.
With the push of a button, I would then like to copy whatever is pasted in the second line into a third line on the same slide, this time repeating the pattern a specified number of times.
The final result will look like the picture below.
http://www.vbaexpress.com/forum/imag...BJRU5ErkJggg==
1 Attachment(s)
vba Selective Copying and Pasting Shapes on the Same PowerPoint Slide
vba Selective Copying and Pasting Shapes on the Same PowerPoint SlideFor Clarity: After you clicked on a shape (and hence select it), it should be replicated down, just below the shape selected, but to the left, i.e. just below the first shape in the "line".
The macro must be started after the click, or double-click (preferably if possible).
The next shape will be in line, horizontally to the right of the previous copy and pasted shape.
The next step is to repeat the new pattern below this line.
See attached file for clarity - The first slide shows how it looks before doing anything and the second the final result.
I found the following working code from PPTools and tried to modify it for my purpose. The third slide of the attached file shows how it is used. If it can be adapted for copying and pasting or duplicating shapes it would be perfect:
Code:
Sub DoItToMe(oShape As Shape)
With oShape
' Add code here to do whatever you like with the shape
' This will make it unfilled if filled or vice versa
.Fill.Visible = Not (.Fill.Visible)
End With
End Sub
Any help will be highly appreciated
Best Regards
Vanhunk
2 Attachment(s)
vba Selective Copying and Pasting Shapes on the Same PowerPoint Slide
Good day
I have adapted the code by John Wilson and it is working perfectly, solving the first part of the problem
The following code is in the slides code and a button is used to reset the global iCnt variable to 10:
Code:
Private Sub CommandButton1_Click()
iCnt = 10
End Sub
The following code is in a normal module:
Code:
Option Explicit
Global iCnt As Integer
Sub copyme(oshp As Shape)
Dim newshp As ShapeRange
oshp.Copy
Set newshp = oshp.Parent.Shapes.Paste
newshp(1).Top = oshp.Top + 100
newshp(1).Left = iCnt
iCnt = iCnt + 110
End Sub
The second part is to copy whatever is in the second row a number of times to the third row, i.e. repeat the pattern created in the second line a number of times.
Any further assistance is greatly appreciated.
Best Regards
Vanhunk