![]() |
#1
|
|||
|
|||
![]()
I need to copy size, position, formatting of one object and to apply to other objects on different slides through vba.
Thanks for your help. Regards, Manoj |
#2
|
|||
|
|||
![]()
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 |
#3
|
|||
|
|||
![]()
Hi,
Thanks. If I select one object and chose Pick up format from macro and then I go the desired slide, where I select other object and choose Apply format. It shows msg as "choose pick up format" and tried 2-3 times but not get successes. Regards, Manoj |
#4
|
|||
|
|||
![]()
Did you copy and paste all of the code (including the four Dims)??
Download a sample here and see if it works |
#5
|
|||
|
|||
![]()
Thanks for your reply. I had many macros, when I pasted including the four dims, the dims came below the last macro and others started as new macro.
I think, now it is working. Thanks for your help. |
#6
|
|||
|
|||
![]()
Yep declarations need to be at the top!
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Copy table to another location in the same document | Sektor | Word VBA | 2 | 03-31-2014 09:28 PM |
![]() |
kent | Word VBA | 5 | 06-14-2012 02:18 PM |
![]() |
buckaroobanzai | PowerPoint | 1 | 06-08-2012 05:32 AM |
Format template to allow user typing to jump to a new location | dan28029 | Word | 2 | 02-13-2012 06:35 AM |
Window Location & Size | Ringmaster | Outlook | 0 | 09-14-2010 02:41 AM |