web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using variables in Win...
Power Automate
Answered

Using variables in Window name giving an error

(0) ShareShare
ReportReport
Posted on by 4

Hi

 

I am trying to build a selector which will click on 'File' tab in a Word document that is open. The name of the Word document will vary. So I created a variable, NewVar, which has the partial name of the Word document. 

 

Say the document is named test1.docx, I assigned the string 'test' to NewVar.

 

I selected the UI element and modified the Name attribute of the Window to 'Contains' %NewVar%, as given below.

 

:desktop > window[Name*="%NewVar%"][Process="WINWORD"]

 

If I run this, it shows an error saying that the window cannot be found.

 

However, if I change the Name attribute to 'Contains' 'test', as given below, it works without any issue.

 

  :desktop > window[Name*="test"][Process="WINWORD"]

 

I would really appreciate it if anyone can throw light on why the first method is not working and how to get around it?

I have the same question (0)
  • Verified answer
    VJR Profile Picture
    7,635 on at

    Hi @yashwanth 

     

    Make sure to use the Custom toggle in the selector builder.

     

    Below is the link that will help on this.

    Solved: Dynamic Selector (variable in selector) in Desktop... - Power Platform Community (microsoft.com)

     

     

  • azimzicar Profile Picture
    72 on at

    Hi @yashwanth 

     

    As suggested by @VJR you've got to enable the custom toggle - step 1

     

    Then you need to put in the variable without quotation marks - step 2

     

     

    :desktop > window[Name*=%NewVar%][Process="WINWORD"]

     

     

    I've tested it and this solution works. Didn't work with the quotation marks on. 

  • yashwanth Profile Picture
    4 on at

    Hi @VJR 

     

    I used the Custom toggle and it worked. 

    Thank you.

  • VJR Profile Picture
    7,635 on at

    Hi @yashwanth 

     

    Please do share some screenshots - what are the inputs and what outputs are you getting

    Also check if it is some other error.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 273 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 149 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 144 Super User 2026 Season 2

Last 30 days Overall leaderboard