Word VBA updating a 'Field'

On a Word document I need to programatically update (what looks like a) Field with VBA. But I'm not sure whether they are Fields, as Fields have curly brackets, not square ones. See here.
Example
I tried this
ActiveDocument.FormField("Issue status").Result = "Hello"

Open in new window


But I get 'object doesn't support this property or method'.

What am I doing wrong?

Thanks.
hindersalivaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EirmanChief Operations ManagerCommented:
Does manual updating work? (F9)
0
hindersalivaAuthor Commented:
Eirman, it's a placeholder that I need to update from some textboxes on a UserForm.
No, F9 would do nothing.

I now think these are Content Controls.
I'm thinking I should be able to update it like this. But it's not right, because the intellisense doesn't come up.
ActiveDocument.SelectContentControlsByTag("Status").Text = "Hello"

Open in new window

0
GrahamSkanRetiredCommented:
It might be a bookmark. If so, and if it's name is "IssueStatus" ("Issue Status" is illegal as a bookmark name) then try, after adding an 's' to FormField:
ActiveDocument.FormFields("IssueStatus").Result = "Hello"

Open in new window

If it's just a bookmark without being a FormField name then
ActiveDocument.Bookmarks("IssueStatus").Range.text= "Hello"

Open in new window

If that doesn't work either, post a non-confidential sample.
Note that you can use Find/GoTo to see the bookmark names in the document. Also Alt+F9 with toggle the display of fields in the Selection between result and code.
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

GrahamSkanRetiredCommented:
Oops. cross-posted.
SelectContentControlsByTag returns a collection, so try
ActiveDocument.SelectContentControlsByTag("Status")(1).Text = "Hello

Open in new window

"
0
GrahamSkanRetiredCommented:
Select the control and click Properties in the Developer tab to see the Tag and Title names
0
hindersalivaAuthor Commented:
Graham, I have attached a piece of the document. See the 'box' [Status]
Sample.docx
0
GrahamSkanRetiredCommented:
Thanks. That has settled it. I was careless about the correct property to use. This works:
Activedocument.SelectContentControlsByTag("Issue Status")(1).Range.Text = "Hello"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hindersalivaAuthor Commented:
Brilliant Graham. Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.