Share via

Method Invocation Exception,Null Reference Exception displayed in powershell when uiautomation clicks the Microsoft Word File Tab.

骏 高 1 Reputation point
2022-05-10T04:14:57.61+00:00

Steps:

  1. Open the microsoft word document [Office19_W_006_PCL6-E_A4LCp17EN.docx]
  2. In Microsoft Word Document Window, Click File Tab.
    Here, I used Microsoft Uiautomation API below
    Step2.1. Click File Tab by Invoke() ->Exception Occured, Goto Step2.2
    Step2.2. Click File Tab by Select() ->Exception Occured, Goto Step2.3
    Step2.3. Click File Tab by Toggle() ->Exception Occured, Goto powershell Error
  3. Powershell Error:
    200467-image.png

Question:
Is there something wrong with the document I used?
or Is there something wrong with the Microsoft Uiautomation API I used?

When I used other .docx document to test, exception above does not occur.
When I delete some data like this, the powershell script will be run OK.
200448-image.png

Comments:
Microsoft Word document's File Tab UI infomation got by inspect.exe.
200486-image.png

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

1 answer

Sort by: Most helpful
  1. 骏 高 1 Reputation point
    2022-05-13T05:57:39.63+00:00

    Is there anyone can follow this question?
    @tbgangav-MSFT

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.