Can anyone help please?
I have created a PowerPoint Wizard that allows the user to create a brand specific presentation. They also have the ability to edit the presentation and insert specific slides by clicking on the ribbon. I am using the SlideIndex as a guide to inserting the slide in the correct place but this will only work when a slide is selected (under Normal View). If the user places the cursor between two slides (under Normal View) I am unable to pick up the SlideIndex. On investigation I can see that the Type when a user is selecting a slide is "ppSelectionSlides" and when the cursor is between two slides it is recognised as "ppSelectionNone".
Is there a way of determining where I am when the cursor is between two slides? I have a feeling that there must be as when I use the Microsoft "Insert Slide" option I can have the slide selected or the cursor between two slides.
Many thanks
Jack
Identifying a slide (PowerPoint 2007/VB.Net)
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
-
- Administrator
- Posts: 78595
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Identifying a slide (PowerPoint 2007/VB.Net)
As far as I can tell, the position of the "insertion bar" between slides is not exposed to PowerPoint VBA, so I fear that you'll have to issue a warning if Selection.Type = ppSelectionNone:
Code: Select all
If ActiveWindow.Selection.Type = ppSelectionNone Then
MsgBox "Please click inside a slide, then try again.", vbExclamation
Exit Sub
End If
...
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12623
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Identifying a slide (PowerPoint 2007/VB.Net)
Does the example code in this thread solve your problem?Jack21 wrote:Can anyone help please?...
StuartR
-
- Administrator
- Posts: 78595
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Identifying a slide (PowerPoint 2007/VB.Net)
Good catch - so the trick is to switch to slide view and back - this will guarantee that a slide is selected:
Code: Select all
If ActiveWindow.Selection.Type = ppSelectionNone Then
Select Case ActiveWindow.ViewType
Case ppViewNormal
ActiveWindow.ViewType = ppViewSlide
ActiveWindow.ViewType = ppViewNormal
Case ppViewSlideSorter
ActiveWindow.ViewType = ppViewSlide
ActiveWindow.ViewType = ppViewSlideSorter
Case Else
' ?
End Select
End If
' A slide should be selected now
...
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Identifying a slide (PowerPoint 2007/VB.Net)
In the previous piece of development (vba) I had to trap the "ppSelectionNone" and was really keen this time (VB.net) to be able to run the function wherever the user placed the user.
Many thanks all, I'll give it a try.
Regards
Jack
Many thanks all, I'll give it a try.
Regards
Jack