I have solved it.
The code lets you click on any shape on a PowerPoint slide in Presentation Mode to copy and paste it to a new position on the slide, in sequence. I.e., pasted shapes will be next to each other in a line, not overlapping. When a new line is selected (with the applicable button), it starts pasting on the new line. If you make a mistake, the last pasted shape can be deleted. You can change the X-position of the past position with the applicable button and delete all the pasted shapes, ending up with the slide in its original condition. All of this must be executed from within Presentation Mode.
Public Variables:
Public yCnt As Integer
Public zCnt As Integer
Public Const yZero As Integer = 0
Dim lastPastedImage As Shape
Code activated by clicking on any shape on the slide in Presentation Mode (Code in Normal Module):
Sub copyme(oshp As Shape)
Dim newshp As ShapeRange
oshp.Copy
Set newshp = oshp.Parent.Shapes.Paste
newshp(1).Top = oshp.Top + yCnt
newshp(1).Left = xCnt
zCnt = xCnt
xCnt = xCnt + oshp.Width + 10
' Set lastPastedImage = ActivePresentation.Slides(1).Shapes(ActivePresentation.Slides(1).Shapes.Count)
Set lastPastedImage = ActivePresentation.Slides(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex).Shapes _
(ActivePresentation.Slides(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex).Shapes.Count)
End Sub
Code activated by UNDO "Button" on slide in presentation mode (Code in Normal Module and an Action was added to the button (rectangle block)):
Sub DeleteLastPastedImage()
If Not lastPastedImage Is Nothing Then
lastPastedImage.Delete
xCnt = zCnt
Set lastPastedImage = Nothing ' Clear the reference
Else
MsgBox "No pasted image to delete."
End If
End Sub
The following code is to change the pasting position to a new line. (Code situated on specific slide under MicroSoft PowerPoint Objects):
Private Sub cmdNewLine_Click()
' New Line
xCnt = 15
yCnt = yCnt + 70 '90
End Sub
The following code is to change the pasting position to its original position and delete all images from the area where the pasting gets done. (Code situated on specific slide under MicroSoft PowerPoint Objects):
Private Sub cmdRESET_Click()
yCnt = 70 '90
xCnt = 15
DeletePicturesInAreaSS
End Sub
Sub DeletePicturesInAreaSS()
' This code is intended to be run from within Slide Show view.
' It deletes all images in the specified area of the slide, as well as images
' with enough height overlap with the specified area:
Dim sld As Slide
Dim shp As Shape
Dim i As Integer
Dim deletedCount As Integer
' Define the area (in points):
Dim areaLeft As Single: areaLeft = 0 ' X-coordinate of top-left corner
Dim areaTop As Single: areaTop = 120 ' Y-coordinate of top-left corner
Dim areaRight As Single: areaRight = 960 ' X-coordinate of bottom-right corner
Dim areaBottom As Single: areaBottom = 540 ' Y-coordinate of bottom-right corner
' Reference the current slide in Slide Show view
Set sld = SlideShowWindows(1).View.Slide
deletedCount = 0
' Loop backwards to safely delete shapes:
For i = sld.Shapes.Count To 1 Step -1
Set shp = sld.Shapes(i)
If shp.Type = msoPicture Or shp.Type = msoAutoShape Then
' Calculate the right and bottom edges of the shape
Dim shpRight As Single: shpRight = shp.Left + shp.Width
Dim shpBottom As Single: shpBottom = shp.Top + shp.Height
If shp.Top >= areaTop Then
shp.Delete
deletedCount = deletedCount + 1
ElseIf (shpBottom - areaTop) / (shpBottom - shp.Top) >= 0.8 Then
shp.Delete
deletedCount = deletedCount + 1
End If
End If
Next i
' If deletedCount = 0 Then
' MsgBox "No pictures found in the specified area.", vbInformation
' Else
' MsgBox deletedCount & " picture(s) deleted from the area.", vbInformation
' End If
End Sub
The following code is to change the pasting X-position only to its original position. (Code situated on specific slide under MicroSoft PowerPoint Objects):
Private Sub cmdResetX_Click()
xCnt = 15
End Sub
[/code]