• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

where to put ppt code to copy and paste property

Hii Team

I have a code of powerpoint in which it copies properties of selected object and then to other selected objects it pastes all the same properties.

But i am unable to use this code as how should i use this code in various and different ppts.

Please advise.

thanks


Code:
Option Explicit

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


[\CODE]
 
Back
Top