Consulting

Results 1 to 3 of 3

Thread: Include Section name in filenames of images

  1. #1
    VBAX Regular
    Joined
    Sep 2018
    Posts
    6
    Location

    Include Section name in filenames of images

    Hi,

    I'd like the filenames of images to include Section name.

    This is my code so far:

    Sub SaveImagesSection()
    Dim oSldSource As Slide
    Dim oShpSource As Shape
    Dim Ctr As Integer


    Dim sPath As String


    sPath = "xxx"
    Ctr = 1


    For Each oSldSource In ActivePresentation.Slides
    For Each oShpSource In oSldSource.Shapes

    If oShpSource.Type = msoGroup Then

    Call oShpSource.Export(sPath & [Section Name here] & Format(Ctr, "00") & ".png", ppShapeFormatPNG)

    Ctr = Ctr + 1
    End If

    Next oShpSource
    Next oSldSource




    End Sub

    Thanks in advance

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Try something like this:

    Sub SaveImagesSection()
        Dim oSldSource As Slide
        Dim oShpSource As Shape
        Dim Ctr As Integer
        Dim secName As String
        Dim sPath As String
        sPath = "C:/users/info/Desktop/"
        Ctr = 1
        For Each oSldSource In ActivePresentation.Slides
            For Each oShpSource In oSldSource.Shapes
    
    
                If oShpSource.Type = msoGroup Then
                    If ActivePresentation.SectionProperties.Count > 0 Then
                        secName = ActivePresentation.SectionProperties.Name(oSldSource.sectionIndex)
                    End If
                    Call oShpSource.Export(sPath & secName & Format(Ctr, "00") & ".png", ppShapeFormatPNG)
                    Ctr = Ctr + 1
                End If
            Next oShpSource
        Next oSldSource
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    Sep 2018
    Posts
    6
    Location

    Smile Thank you so much, John

    Worked a treat. Thank you so much, John.

    I forgot the final backslash in the filepath but eventually figured out why nothing was happening.

    Regards,
    Petra

Tags for this Thread

Posting Permissions

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