Macro that copies a range of slides from main presentation

B

Buddhapenguin

I am attempting to build a macro that will copy a range of slides from a Main
Presentation, open a new presentation, and paste those slides into a new
presentation, therebye creating a sub-presentation from the Main
Presentation.

The user has the option in the Powerpoint to select which chunks of the
presentation to split, using checkboxes, and then user selects a button,
that, upon selecting, all checked chunks are copied and pasted to a new
presentation. Note that as I currently have it, each checkbox relates to a
textbox that holds the slide numbers for the slides that are to be copied
should that textbox be checked. These textboxes will be locked to the user.
Simple picture:

Checkbox Text box
[X] Section A [1 , 2, 4]
[ ] Section B [5, 7, 8]
[X] Section C [9, 10, 11]

Given the above, if the user pushes the button, a new PP is started and the
slides numbered above are copied from the original and pasted into the new.

I have introductory experience with basic VBA and have used textboxes and
buttons before. The below is my VBA to this point. Note that the code goes
out to a template on the server in order to ensure the formatting is retained
on paste, and then deletes the slides that are in the template once the paste
is done. Also, the macro currently breaks. I am trying to have the Dim Seg1
Variant Array set by the text in the text box, but the way i have worded it
is not clean. You can see for seg2 and seg3 the original approach that I
took, which requires the PP creater to go into the VBA code to set the arrays.

Also, currently the paste only pastes one of the copies. I have not figured
out how to do a CTRL + select copy (multicopy) in VBA.

I hope the VBA and explanation helps give you a picture of what I am trying
to do. If you can help in anyway, or have a better approach to take then the
direction that I am heading in below, I'm willing to try about anything at
this point.

Thanks:

Current VBA:

Private Sub GenReport1_Click()

Dim Seg1 As Variant
Seg1 = Array(TextSeg1.Value)

Dim Seg2 As Variant
Seg2 = Array(1, 5, 6)

Dim Seg3 As Variant
Seg3 = Array(1, 7, 8)

With ActivePresentation

If CheckSeg1.Enabled = True Then
.Slides.Range(Seg1).Copy
End If

If CheckSeg2.Enabled = True Then
.Slides.Range(Seg2).Copy
End If

If CheckSeg3.Enabled = True Then
.Slides.Range(Seg3).Copy
End If

Presentations.Open FileName:="\\address", Untitled:=msoTrue
ActiveWindow.View.Paste
ActivePresentation.Slides(1).Delete

End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top