Jump to content

Recommended Posts

Posted

Hi, there.

I'm trying to edit specific text boxes in a Word document, but I'm running into issues because they're grouped? (I think??)

I used the Macro recorder, and it shows:

 

ActiveDocument.Shapes.Range(Array("Group 5")).Select
    ActiveDocument.Shapes.Range(Array("Text Box 8")).Select
    Selection.TypeText Text:="Centre"


Could some kind soul please tell me how to access these in AutoIt?

All assistance gratefully received.

Posted

You can get the shape this way:

 

$oDoc.Shapes("Group 5").GroupItems("Text Box 8")

 

Saludos

Posted
On 3/19/2026 at 6:05 PM, Danyfirex said:

You can get the shape this way:

 

$oDoc.Shapes("Group 5").GroupItems("Text Box 8")

 

Saludos

Thank you for the reply. Sorry I didn't respond before now - I don't get notifications from the forum.

I'll give this a try shortly.

 

Posted

Arghh.. I feel like I'm almost there? My lack of knowledge on using "with" is letting me down..

$test = $oDoc.Shapes("Group 5").GroupItems("Text Box 61").Select

Highlights the textbox in the Word Document...

But how do I change the contents of the text box to be "Hello world"?

Or read the current value of that textbox?

I've tried 

$test = $oDoc.Shapes("Group 5").GroupItems("Text Box 61").Select.TypeText
$test = $oDoc.Shapes("Group 5").GroupItems("Text Box 61").Select.Text
$test = $oDoc.Shapes("Group 5").GroupItems("Text Box 61").Select.TypeText.Text

They all return a blank value.

I know I'm missing something REALLY obvious!!

I've tried using "With ODoc.blah, OWord.blah"... It just throws up errors about the requested action with this object has failed.

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...