PDA

View Full Version : [SOLVED:] Copy slides from A to B presentation



bucksfc
03-04-2016, 02:33 PM
Hey Guys,

This is time sensitive so I will give the first one that answers it correct a prize. I am active army and just got back from Korea. I got a cool plaque with wire from the DMZ on it. I will mail it to you for free. Just pm me your mailing address or put it in the comments. ( I really need help!)

This is my first time asking a question here. I am trying to take two presentations (one with old data and one with new) and combine them. The slide deck is 135 slides so coping the slides manually takes forever since I need it to go: old slide new slide old slide new slide and so on. So when the General flips through the book t here is last months data on one side and this months on the other. I do this so he can see out progress. I know there is a way to do it with a loop I'm just a FNG.


Here is what I tried:

Sub insert()
Dim x As Long

x = 0
For x = x + 1 To 135

Presentations("STB reinspection outbrief.pptx").Slides.InsertFromFile _
FileName:="C:\Users\david.m.taylor\Documents\SAV\Completed Inspections\129 reinspection outbrief.pptx", Index:=x, _
SlideStart:=x, SlideEnd:=x

Next x
End Sub



Also, I really need to use the dialog box to pick the old slide deck since the names change. Please help.....Im begging ya

Thanks,

David Taylor

bucksfc
03-04-2016, 02:34 PM
Hey Guys,

This is time sensitive so I will give the first one that answers it correct a prize. I am active army and just got back from Korea. I got a cool plaque with wire from the DMZ on it. I will mail it to you for free. Just pm me your mailing address or put it in the comments. ( I really need help!)

This is my first time asking a question here. I am trying to take two presentations (one with old data and one with new) and combine them. The slide deck is 135 slides so coping the slides manually takes forever since I need it to go: old slide new slide old slide new slide and so on. So when the General flips through the book t here is last months data on one side and this months on the other. I do this so he can see out progress. I know there is a way to do it with a loop I'm just a FNG.


Here is what I tried:


Sub insert()
Dim x As Long

x = 0
For x = x + 1 To 135

Presentations("STB reinspection outbrief.pptx").Slides.InsertFromFile _
FileName:="C:\Users\david.m.taylor\Documents\SAV\Completed Inspections\129 reinspection outbrief.pptx", Index:=x, _
SlideStart:=x, SlideEnd:=x

Next x
End Sub



Also, I really need to use the dialog box to pick the old slide deck since the names change. Please help.....Im begging ya

Thanks,

David Taylor

John Wilson
03-05-2016, 12:44 AM
For x=x+1 to 135 isn't going to work. Are you trying to only insert every second slide (maybe odd or even numbers)?

This is top of head untested code but might get you closer. (no need to offer prizes BTW)


Sub insert() Dim x As Long
x = 0
For x = 1 To 135 Step 2 'if odd or for x= 2 to 135 step 2 if even
Presentations("STB reinspection outbrief.pptx").Slides.InsertFromFile _
FileName:="C:\Users\david.m.taylor\Documents\SAV\Completed Inspections\129 reinspection outbrief.pptx", Index:=x, _
SlideStart:=x, SlideEnd:=x
Next x
End Sub

You might need to rethink WHERE the slides insert as you may need to allow for the slides already added but for the time being lets get the correct slides inserted somewhere!

John Wilson
03-05-2016, 12:51 AM
For x=x+1 to 135 isn't going to work. Are you trying to only insert every second slide (maybe odd or even numbers)?

This is top of head untested code but might get you closer. (no need to offer prizes BTW)


Sub insert() Dim x As Long
x = 0
For x = 1 To 135 Step 2 'if odd or for x= 2 to 135 step 2 if even
Presentations("STB reinspection outbrief.pptx").Slides.InsertFromFile _
FileName:="C:\Users\david.m.taylor\Documents\SAV\Completed Inspections\129 reinspection outbrief.pptx", Index:=x, _
SlideStart:=x, SlideEnd:=x
Next x
End Sub

You might need to rethink WHERE the slides insert as you may need to allow for the slides already added but for the time being lets get the correct slides inserted somewhere! Are the new slides meant to REPLACE the old ones?

SamT
03-05-2016, 09:26 AM
For X = 1 to 135
Insert NewSlide(X) After OldSlide((X * 2) - 1)

bucksfc
03-05-2016, 09:35 AM
Hey John,

Thanks for the reply! I am wanting to add all the slides from the old presentation to the new one. The problem is, I currently have to copy each individual because here is how it looks with the new presenation as A and the old one as B

A1
B1
A2
B2
A3
B3
A4
B4

You are aboslutley right about having to take account for the growing numbers of slides when they are being copied over. Let me play with what you sent for a little bit and Ill reply back. Thanks so much for your help. Let me see what happens. Be right back.


David

SamT
03-05-2016, 09:50 AM
Duplicate Threads combined into this one.

Thread Title edited due to glitch in VBAX server. The Word "Insert" seemed to be the problem

bucksfc
03-06-2016, 05:40 AM
SamT,

Thats the math I needed. Worked like a charm. I figured the out file browser thing to. Go ahead and shoot me your mailing address and I'll send you something. Thanks for your help.

David T.

SamT
03-08-2016, 05:22 PM
I PMed you. Check your Notifications