Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
as544038544038 opened this issue Nov 22, 2024 · 0 comments

Comments

@as544038544038
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant