2 Replies - 1286 Views - Last Post: 14 November 2011 - 01:39 AM Rate Topic: -----

#1 catfunt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-July 11

vb6 ActivePresentation equivalent for MS VB 2010 powerpoint add-in

Posted 11 November 2011 - 08:50 AM

Hi,

I made a macro for MS Powerpoint 2010 in its own VB6 environment, then I downloaded VS 2010 Ultimate with a view to turning it into a proper "Add-In" that I can deploy to other machines. The macro works perfectly in MS Powerpoint 2010.

The problem is that VS 2010 seems to not support older VB6 objects. Here is a snippet of code that I am stuck on:

slideToApply = Int(InputBox("Enter slide number to process"))
'Grab focus on the relevant slide
currentSlide = ActivePresentation.Slides(slideToApply)
currentSlide.Select()


The compiler tells me that "ActivePresentation is not declared. It may be inaccessible due to its protection level".

So, my question is how do I select a slide by the slide number in the "active presentation" in VB 2010?

I can't work it out via Google search, so I ask here.

Many thanks in advance,
Dave

Is This A Good Question/Topic? 0
  • +

Replies To: vb6 ActivePresentation equivalent for MS VB 2010 powerpoint add-in

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4187
  • View blog
  • Posts: 11,845
  • Joined: 18-April 07

Re: vb6 ActivePresentation equivalent for MS VB 2010 powerpoint add-in

Posted 11 November 2011 - 11:44 AM

Show us more of what you have defined. Also try to define a variable of type Powerpoint.Presentation and using that variable to call ActivePresentation on..

Dim powerPt As New Microsoft.Office.Interop.PowerPoint.Application

' Access activepresentation and get collection of slides
Dim s As Slides
s = powerPt.ActivePresentation.Slides()



This of course assumes you added a reference to the Powerpoint COM object. From there you have a list of slide manipulations etc and should get you on the right track to what you are trying to do.

:)
Was This Post Helpful? 1
  • +
  • -

#3 catfunt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-July 11

Re: vb6 ActivePresentation equivalent for MS VB 2010 powerpoint add-in

Posted 14 November 2011 - 01:39 AM

Hi,

Many thanks for your reply. That fixes the problem actually. I just create a PPT object and then I can reference ActivePresentation.

Very much appreciated!

Best,
Dave
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1