Microsoft Knowledge Base Email Alertz

KBAlertz.com: (285472) - When you attempt to run a Visual Basic for Applications macro that creates or opens a PowerPoint presentation, you may receive the following or similar error message: Run-time error '-2147188160 (80048240)': Application (unknown member): Invalid...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 285472 - Last Review: June 8, 2007 - Revision: 3.1

Run-time error -2147188160 on ActiveWindow or ActivePresentation call in PowerPoint

This article was previously published under Q285472

SYMPTOMS

When you try to run a Microsoft Visual Basic for Applications macro that creates or opens a Microsoft PowerPoint presentation, you may receive an error message that resembles the following error message:
Run-time error '-2147188160 (80048240)':

Application (unknown member): Invalid request. There is no currently active document window.
The same macro runs without error in Microsoft Office 97.

CAUSE

This behavior is caused by using any PowerPoint ActiveWindow or ActivePresentation property, method, or event when the PowerPoint program is not visible. The following sample code will cause this error.
Sub A()
    Dim oPpt As PowerPoint.Application
    Set oPpt = New PowerPoint.Application
    oPpt.Presentations.Add
    oPpt.Presentations(1).Slides.Add 1, ppLayoutBlank

    'The following line causes the run-time error
    msgbox oPpt.ActiveWindow.Caption

End Sub
				
Note This error message does not occur in Microsoft PowerPoint 97.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To work around this behavior, add the following lines of code once in any sub procedure before any ActiveWindow or ActivePresentation calls.
    If PowerPoint.Application.Version >= 9 Then
        'window must be visible
        PowerPoint.Application.Visible = msoTrue
    End If
				
This code makes PowerPoint visible for Microsoft PowerPoint 2000 and for later versions of PowerPoint. PowerPoint 97 does not need to be made visible.

The sample code that is mentioned in the "Cause" section would change to the following code.
Sub A()
    Dim oPpt As PowerPoint.Application
    Set oPpt = New PowerPoint.Application
    oPpt.Presentations.Add
    oPpt.Presentations(1).Slides.Add 1, ppLayoutBlank
    If oPpt.Version >= 9 Then
        'window must be visible
        oPpt.Visible = msoTrue
    End If
    oPpt.ActiveWindow.View.GotoSlide 1
End Sub
				
Note This workaround may not work for Microsoft Office PowerPoint 2007.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

APPLIES TO
  • Microsoft Office PowerPoint 2007
  • Microsoft PowerPoint 2002 Standard Edition
Keywords: 
kbbug kberrmsg kbpending KB285472
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Simon - simon.q.rice NOSPAM-AT-NOSPAM gsk.com Report As Irrelevant  
Written: 10/20/2004 12:08 PM
I'm experiencing similar problems with this error code when using Excel 2002 and referencing an existing PowerPoint presentation. My code works ok in normal view but I get this error message when in slide view. I fel I'm getting closer to the solution but not quite yet. Anyone any further suggestions? Thank you in anticipation

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please