Share via

ActivePresentation returns wrong presentation when multiple presentations are open

Anonymous
2014-09-02T12:12:34+00:00

I have got a VBA PowerPoint add-in which has a custom ribbon bar tab.  Many of the options on the ribbon bar use ActivePresentation to get the presentation the user currently has open.

ActivePresentation doesn't appear to work if the user has multiple presentations open though.  In this case, ActivePresentation returns the presentation the user first opened and not the one that they've got open when they click the option on the ribbon bar. It appears as if the add-in is somehow tied to the presentation that launched the add-in.

If I then close the first presentation that was opened, ActivePresentation then works correctly returning the presentation that the user currently has their cursor in.

Has anyone come across this problem?  Is there something I need to do to make the add-in realise that the active presentation is the one that the user currently has the cursor in rather than the one that they initially opened?

TIA

Julie

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2014-09-03T07:06:25+00:00

I can see how that might happen if the form was still loaded (even if hidden) in a presentation it might activate it when called.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

11 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-09-02T13:42:31+00:00

    Thanks John.

    I've just checked my code - I definitely haven't declared ActivePresentation as a variable and that set it to a particular presentation.

    I'm completely stumped with this issue at the moment!

    Julie

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-09-02T13:13:58+00:00

    Hard to say what's wrong but that should work!

    getVisible shouldn't affect anything (presuming it works OK and is coded correctly)

    I'm sure you wouldn't do this but stupidly PPT allows you declare ActivePresentation as a variable and set it to particular presentation

    Dim ActivePresentation As Presentation

    Set ActivePresentation = Presentations(1)

    Otherwise I don't know,

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-09-02T12:51:54+00:00

    Hi John

    Thanks for your reply.

    The add-in is simply in the %appdata%\Microsoft\AddIns folder and is enabled in PowerPoint using File->Options->Add-Ins->PowerPoint add-ins so it should be active when PowerPoint is launched.

    I'm not sure if it makes any difference but the ribbon bar XML makes use of GetVisible to determine whether the ribbon bar tab is visible (the options that are visible are dependent on what the user has selected in the presentation).  I can't think why that would make any difference to what ActivePresentation returns.

    Julie

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-09-02T12:33:08+00:00

    ActivePresentation should always refer to, well, the Active Presentation. It shouldn't be tied to the presentation that launched the AddIn (in fact the AddIn isn't normally launched by a presentation at all.)

    Hard to say what's wrong without seeing the XML and vba but the ActivePresentaion code should definitely work as expected.

    Maybe describe HOW you loaded the AddIn.

    Was this answer helpful?

    0 comments No comments