Consulting

Results 1 to 3 of 3

Thread: Inserting Slides Behind Current Slide rather than at the end

  1. #1
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location

    Inserting Slides Behind Current Slide rather than at the end

    Hi John

    I have this code that you fantastically created, and I'm sure people will find useful, but I have a question:

    It inserts slides at the end of the current document, can it insert selected slides (files) to after the slide you're currently viewing?

    I.e. say you have file Z open, with 7 slides and you are viewing slide 3, this tool inserts them after slide 3 rather than at the end?

    Thank you


    HTML Code:
    Sub ViewSlides()
    Dim L As LongDim opres As PresentationDim FD As FileDialogSet opres = ActivePresentationSet FD = Application.FileDialog(msoFileDialogOpen)With FD.InitialFileName = "C:\".ButtonName = "Merge".AllowMultiSelect = True.Filters.Clear.Filters.Add "Presentations", "*.pptx"If .Show = True ThenIf .SelectedItems.Count > 0 ThenFor L = 1 To .SelectedItems.CountCall opres.Slides.InsertFromFile(.SelectedItems(L), opres.Slides.Count)Next LEnd IfEnd IfEnd With
    Exit Sub
    End Sub

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    See if this works.

    Sub ViewSlides()
    Dim L As Long
    Dim opres As Presentation
    Dim FD As FileDialog
    Dim lngPos As Long
    Set opres = ActivePresentation
    'get current position
    lngPos = ActiveWindow.Selection.SlideRange(1).SlideIndex
    Set FD = Application.FileDialog(msoFileDialogOpen)
    With FD
    .InitialFileName = "C:\"
    .ButtonName = "Merge"
    .AllowMultiSelect = True
    .Filters.Clear
    .Filters.Add "Presentations", "*.pptx"
    If .Show = True Then
    If .SelectedItems.Count > 0 Then
    For L = 1 To .SelectedItems.Count
    Call opres.Slides.InsertFromFile(.SelectedItems(L), lngPos)
    Next L
    End If
    End If
    End With
    Exit Sub
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location
    PERFECT CODE - THANK YOU!!

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
  •