View Full Version : How to copy formatting from PPT1.ppt to another PPT2.ppt
jesper
11-18-2017, 07:07 PM
Hi
I am trying to Pickup and Apply formatting from Grouped shapes in one ppt a simular grouped shapes in another ppt.
Need some assistance to make it work.
Sub formattingChange()
Dim oPPT1 As Presentation
Dim oPPt2 As Presentation
Set oPPT1 = Application.Presentations("testppt")
Set oPPt2 = Application.Presentations("testppt2")
With Windows("testpp2").Selection.ShapeRange("3kant").PickUp
With Windows("testppt").Selection.ShapeRange("3kant").Apply
End Sub
the VBA returns with Expected function or variable.
Hope someone have an easy fix.:bow:
Paul_Hossler
11-20-2017, 07:27 AM
You probably don't want the 'With' on .....
Windows("testpp2").Selection.ShapeRange("3kant").PickUp
Windows("testppt").Selection.ShapeRange("3kant").Apply
Not sure that is what's needed
John Wilson
11-21-2017, 05:26 AM
You would have to specify which slide each shape is on. In this case I have used slide 1
Sub formattingChange() Dim oPPT1 As Presentation
Dim oPPt2 As Presentation
Set oPPT1 = Application.Presentations("testPPT1")
Set oPPt2 = Application.Presentations("testPPT2")
oPPT1.Slides(1).Shapes("skant").PickUp
oPPt2.Slides(1).Shapes("skant").Apply
End Sub
jesper
11-26-2017, 12:22 AM
Hi both John's
I simply can not make that code work as I want.
Perhaps the thing I want to do is simply not do-able.
How can ppt know which shape should have which format?
Maybe I should be more clear in what I want.
See picture.
21056
When running macro, then I need the 3 shapes on the left to change colors to black orange and yellow.
These are the shapes in the group called. 3kant.
the individual shapes in the group have exactly the same names.
Please confirm if the codes you supplied should work under these circumstances, if possible or how a code can be structured.
/Jesper
John Wilson
11-26-2017, 03:45 AM
From the screenshot it looks like the GROUP is called 3kant but the individual shapes are not.
Really it would be best if you posted the presentation but something like this should maybe work.
Change the slide number and the names of the presentations if necessary
Sub changeGrp() Dim opres1 As Presentation
Dim opres2 As Presentation
Dim L As Long
Set opres1 = Presentations("testPPT1")
Set opres2 = Presentations("testPPT2")
With opres1.Slides(1).Shapes("3kant")
For L = 1 To .GroupItems.Count
.GroupItems(L).PickUp
opres2.Slides(1).Shapes("3kant").GroupItems(L).Apply
Next L
End With
End Sub
jesper
11-26-2017, 04:11 AM
Hi John
I will try to post the file.
As with the last time this happens when trying to upload file:21057
Perhaps the file is too big 5.8Mb
/Jesper
jesper
11-26-2017, 05:14 AM
Hi John
I will try to post the file.
As with the last time this happens when trying to upload file:21057
Perhaps the file is too big 5.8Mb
/Jesper
jesper
11-26-2017, 06:20 AM
Hi John
I manage to make a small version of what I am trying to make.
Please find attached
When clicking on some alarms and afterwards update button, then it should be shown on the right side.
21059
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.