Skip to content

Application.Visible: Invalid request. Hiding the application window is not allowed. #63

@as544038544038

Description

@as544038544038

Hello everyone,

I'm currently working on a Java application that interacts with Microsoft PowerPoint using the JACOB (Java COM Bridge) library.
Here's the issue I'm encountering:
When I set the Visible property of the PowerPoint application to false, I receive the following error:

java.lang.RuntimeException: com.jacob.com.ComFailException: Invoke of: Visible
Source: Microsoft PowerPoint
Description: Application.Visible : Invalid request. Hiding the application window is not allowed.

Here's a snippet of my current code:

 ComThread.InitSTA();

    ActiveXComponent ppt = null;
    Dispatch presentations = null;
    Dispatch presentation = null;
     ppt = new ActiveXComponent("PowerPoint.Application");
//      ppt.setProperty("Visible", new Variant(true)); //only true can work
//      ppt.setProperty("Visible",false); //not work
//      ppt.setProperty("Visible", 0);  //not work
      presentations = ppt.getProperty("Presentations").toDispatch();
      presentation = Dispatch.call(presentations, "Open", pptFilePath, new Variant(false),
          new Variant(false), new Variant(false)).toDispatch();

Am I missing something?
Is there a better way to handle the visibility of the PowerPoint application window when using JACOB?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions