Duplicate slide in VBA

K

KLe

In VBA code I goto the last slide and duplicate it as below...
SlideShowWindows(1).View.GotoSlide iLastSlide
'create slide if visitor information entered
If iNewVisitorEntry = 1 Then
'last slide is visitor display and if more than 1 company then
need to duplicate last slide
If iCompanyIndex > 1 Then
SlideShowWindows(1).View.Slide.Duplicate
End If
'update textboxs with company and visitor names

SlideShowWindows(1).View.Slide.Shapes("CompanyTextbox").TextFrame.TextRange.Text = sCompanyName

SlideShowWindows(1).View.Slide.Shapes("Name1Textbox").TextFrame.TextRange.Text = sVisitor1Name

SlideShowWindows(1).View.Slide.Shapes("Name2Textbox").TextFrame.TextRange.Text = sVisitor2Name

SlideShowWindows(1).View.Slide.Shapes("Name3Textbox").TextFrame.TextRange.Text = sVisitor3Name
End If


Help states that .DUPLICATE places the new slide after the selected slide
but I keep getting it before the selected slide.
What am I doing wrong or is Help incorrect ?
 
D

Dan Casey

KLe said:
In VBA code I goto the last slide and duplicate it as below...
SlideShowWindows(1).View.GotoSlide iLastSlide
'create slide if visitor information entered
If iNewVisitorEntry = 1 Then
'last slide is visitor display and if more than 1 company then
need to duplicate last slide
If iCompanyIndex > 1 Then
SlideShowWindows(1).View.Slide.Duplicate
End If
'update textboxs with company and visitor names

SlideShowWindows(1).View.Slide.Shapes("CompanyTextbox").TextFrame.TextRange.Text = sCompanyName

SlideShowWindows(1).View.Slide.Shapes("Name1Textbox").TextFrame.TextRange.Text = sVisitor1Name

SlideShowWindows(1).View.Slide.Shapes("Name2Textbox").TextFrame.TextRange.Text = sVisitor2Name

SlideShowWindows(1).View.Slide.Shapes("Name3Textbox").TextFrame.TextRange.Text = sVisitor3Name
End If


Help states that .DUPLICATE places the new slide after the selected slide
but I keep getting it before the selected slide.
What am I doing wrong or is Help incorrect ?
 
D

Dan Casey

KLe said:
In VBA code I goto the last slide and duplicate it as below...
SlideShowWindows(1).View.GotoSlide iLastSlide
'create slide if visitor information entered
If iNewVisitorEntry = 1 Then
'last slide is visitor display and if more than 1 company then
need to duplicate last slide
If iCompanyIndex > 1 Then
SlideShowWindows(1).View.Slide.Duplicate
End If
'update textboxs with company and visitor names

SlideShowWindows(1).View.Slide.Shapes("CompanyTextbox").TextFrame.TextRange.Text = sCompanyName

SlideShowWindows(1).View.Slide.Shapes("Name1Textbox").TextFrame.TextRange.Text = sVisitor1Name

SlideShowWindows(1).View.Slide.Shapes("Name2Textbox").TextFrame.TextRange.Text = sVisitor2Name

SlideShowWindows(1).View.Slide.Shapes("Name3Textbox").TextFrame.TextRange.Text = sVisitor3Name
End If


Help states that .DUPLICATE places the new slide after the selected slide
but I keep getting it before the selected slide.
What am I doing wrong or is Help incorrect ?

KLe,

You may want to use ActivePresentation.Slides(iLastSlide).duplicate.
follow that with SlideShowWindows(1).View.GotoSlide iLastSlide + 1

regards,
dan
 
K

KLe

KLe said:
KLe,

You may want to use ActivePresentation.Slides(iLastSlide).duplicate.
follow that with SlideShowWindows(1).View.GotoSlide iLastSlide + 1

regards,
dan
Thanks Dan, this worked fine.

Kevin.
 

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