|
Christian Fasold
Posts: 45
Joined: 2013-11-27
|
Hello everybody,
I am currently struggling with a really basic problem:
I have a button which inserts a slide into an active presentation. And I would like to insert it after the currently open slide...
--> Question: How do I find out the currently active slide (in edit mode)?
Thanks a lot and best regards,
Chris |
|
Posted 05 Mar, 2014 04:37:05
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17500
Joined: 2006-05-11
|
Hello Christian,
Public Shared ReadOnly Property CurrrentSlide() As PowerPoint.Slide
Get
Dim activeWindow As PowerPoint.DocumentWindow = PowerPointApp.ActiveWindow
Dim view As PowerPoint.View = activeWindow.View
Dim currentSlide As PowerPoint.Slide = TryCast(view.Slide, PowerPoint.Slide)
Marshal.ReleaseComObject(view)
Marshal.ReleaseComObject(activeWindow)
Return currentSlide
End Get
End Property
{your class}.CurrentSlide.SlideNumber. You might also nee to use {your class}.CurrentSlide.SlideIndex.
As to adding a slide, see http://msdn.microsoft.com/en-us/library/office/ff746586%28v=office.15%29.aspx.
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 05 Mar, 2014 06:20:43
|
|
Top
|
|
Christian Fasold
Posts: 45
Joined: 2013-11-27
|
Hello Andrei,
thanks a lot :-)
I already have the insert of the slide done, I "only" needed to know at which slide the user currently is ;-)
I have pasted your code into my VS2013, and receive the following error:
[img]http://zwischenspeicher.net/cloud/public.php?service=files&t=c997a985754bacb994d7f3fd0b641b94[/img]
Sorry the picture doesn't show up, please just click the URL and you can see it ;-)
What would I need to do that the "PowerPointApp" is recognized?
Thanks a lot again!
Best regards,
Chris |
|
Posted 05 Mar, 2014 07:03:01
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17500
Joined: 2006-05-11
|
Try MyAddin1.AddinModule.CurrentInstance.PowerPointApp.ActiveWindow
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 05 Mar, 2014 07:15:29
|
|
Top
|
|
Christian Fasold
Posts: 45
Joined: 2013-11-27
|
Andrei,
thanks A LOT, that worked beautyfully :-)
Best regards,
Chris |
|
Posted 05 Mar, 2014 07:35:12
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17500
Joined: 2006-05-11
|
You are welcome!
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 05 Mar, 2014 09:20:14
|
|
Top
|
|