Consulting

Results 1 to 9 of 9

Thread: How to copy formatting from PPT1.ppt to another PPT2.ppt

  1. #1
    VBAX Regular
    Joined
    Oct 2017
    Posts
    11
    Location

    How to copy formatting from PPT1.ppt to another PPT2.ppt

    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.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Moderator bump
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    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
    Last edited by Paul_Hossler; 11-20-2017 at 06:36 PM.
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    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
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Regular
    Joined
    Oct 2017
    Posts
    11
    Location

    format copy

    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.
    formatcopyppt.JPG
    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
    Attached Images Attached Images

  6. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    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
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  7. #7
    VBAX Regular
    Joined
    Oct 2017
    Posts
    11
    Location

    Alarmpanel

    Hi John
    I will try to post the file.
    As with the last time this happens when trying to upload file:Udklip.JPG

    Perhaps the file is too big 5.8Mb

    /Jesper

  8. #8
    VBAX Regular
    Joined
    Oct 2017
    Posts
    11
    Location

    can not upload file

    Quote Originally Posted by jesper View Post
    Hi John
    I will try to post the file.
    As with the last time this happens when trying to upload file:Udklip.JPG

    Perhaps the file is too big 5.8Mb

    /Jesper

  9. #9
    VBAX Regular
    Joined
    Oct 2017
    Posts
    11
    Location

    presentation attached

    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.
    Udklip.JPG
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •