ercicttech Posted Thursday at 12:48 AM Posted Thursday at 12:48 AM 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.
Danyfirex Posted Thursday at 06:05 PM Posted Thursday at 06:05 PM You can get the shape this way: $oDoc.Shapes("Group 5").GroupItems("Text Box 8") Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
ercicttech Posted 18 hours ago Author Posted 18 hours ago 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.
ercicttech Posted 18 hours ago Author Posted 18 hours ago 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.
water Posted 13 hours ago Posted 13 hours ago (edited) $sText = $oDoc.Shapes("Group 5").GroupItems("Text Box 8").TextFrame.TextRange.Text Should return the text. You can find an example of how to edit the text in Microsofts Office Reference. Edited 13 hours ago by water Danyfirex 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now