Thread: [Solved] Copy format, size, location
View Single Post
 
Old 05-20-2014, 04:54 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Try:

Dim sngL As Single
Dim sngT As Single
Dim sngH As Single
Dim sngW As Single

Sub Pick_Up_Format()
'picks up format of selected shape
Dim oshp As Shape
On Error Resume Next
Err.Clear
Set oshp = ActiveWindow.Selection.ShapeRange(1)
If Err <> 0 Then
MsgBox "Select a shape!"
Else
sngL = oshp.Left
sngT = oshp.Top
sngW = oshp.Width
sngH = oshp.Height
oshp.PickUp
End If
End Sub

Sub Apply_Format()
' Apply to all selected shapes
Dim oshp As Shape
On Error Resume Next
Err.Clear
If sngH = 0 And sngW = 0 Then
MsgBox "Pick up format first."
Exit Sub
End If
For Each oshp In ActiveWindow.Selection.ShapeRange
If Err <> 0 Then
MsgBox "Select a shape!"
Else
oshp.Apply
oshp.Left = sngL
oshp.Top = sngT
oshp.Width = sngW
oshp.Height = sngH
End If
Next oshp
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote