Oct 03 2023 08:59 AM
Oct 03 2023 08:59 AM
New to this forum and hope to make use of your expertise as I am new at Word automation.
I have a document (Word 365 / 2019) with 3 textboxes that I have inserted using "Insert -> Shapes".
I want to rename these 3 textboxes to my own names.so that I may reference them in my code in Access.
I am unable to locate where I may change the names of the Textboxes. I tried the Developer tab and in Design mode, use the property function, but I still cannot locate wher I can rename the Textboxes.
Any help will be appreciated.
Oct 04 2023 05:11 AM
o rename textboxes in Word 365 / 2019, follow these steps:
Note: If the Developer tab is not visible, right-click on the ribbon and select Customize the Ribbon. Then, check the box next to Developer and click OK.
To rename a textbox named "TextBox1" to "MyTextBox", you would follow these steps:
Once you have renamed the textbox, you can reference it in your Access code using the following syntax:
For example, to get the text in the textbox named "MyTextBox", you would use the following code:
Dim myTextBox As TextFrame Set myTextBox = ActiveDocument.Shapes("MyTextBox").TextFrame Dim myText As String myText = myTextBox.TextRange.Text
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Oct 04 2023 02:43 PM - edited Oct 04 2023 07:29 PM
While my Shape Format Tab has an Arrange Group, my Developer Tab does not.
I have virtually no experience with Access but a lot with Word and this is posted in the Word forum.
If using the Windows version, I would select and save the textboxes in the Textbox or Custom Textbox Building Blocks Gallery assigning them names and categories as desired. They would then be accessed using Insert > Text Box rather than Insert > Shape in Word, itself.
Here is my writing on saving as a Building Block and the vba code used to insert Building Blocks.
If you need more information on Building Blocks I would be happy to provide it.
Oct 05 2023 03:39 AM - edited Oct 05 2023 03:40 AM
You can rename objects (text boxes, shapes, images) in the Selection pane, as other contributors have pointed out in this thread.
I think the Developer options you mention apply to UserForms (= custom dialog boxes) and the Visual Basic Editor, which is the programming interface in Word.
Oct 05 2023 03:50 AM