If Statement

T

Tyron

This is what I need

If no slide is selected then to come up with a message "please select a
slide"

This is my current code which works fine, only if a slide is selected,
otherwise a error message comes up saying nothing is selected.

Private Sub TableA_Click()
With Presentations.Open("G:\Tyronne Soanes\Testingb.ppt", msoFalse)
.Slides(54).Shapes.Range(Array("Text Box 7", "Rectangle 3", "Object
9")).Copy
.Close
End With
ActiveWindow.Selection.SlideRange(1).Shapes.Paste
End Sub
 
D

David M. Marcovitz

You can use something like this:

If ActiveWindow.Selection.Type = ppSelectionSlides Then
MsgBox "some slides"
Else
MsgBox "no slides"
End If

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
D

David M. Marcovitz

Note that this solution only works in slide sorter view where you would
select one or more slides. I think the alternative is to try something
with ActiveWindow.Selection.SlideRange and use the error handling
(OnError Goto ....).
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

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