Solved

Bulk change "Field" variable in Word

Posted on 2014-11-30
5
312 Views
Last Modified: 2014-12-09
I am updating some of our internal documentation.

I use a number of "DocProperty" or Advanced Property\Custom variables in my document.

I am trying to re-organise and standardise naming.

What I need to do is replace all fields with the "DocProperty" value of "IPADDRESS" to the new "DocProperty" value of "1IPADDRESS"

I can manually go thru, select the field, change but with a LOT of these that is very painful.

Wondering if there is a way to make this process a bit easier.

I am using MS Word 2013 SP1
0
Comment
Question by:naughtynat
  • 3
5 Comments
 
LVL 6

Author Comment

by:naughtynat
ID: 40473100
Also, I thought I might be able to change the name of the variable, but if I do that it will just add a new variable so unfortunately that isn't possible.
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40473155
Hi,

You can change the variable Name with VBA without adding a property

ActiveDocument.CustomDocumentProperties("IPADDRESS").Name = "1IPADDRESS"

Regards
0
 
LVL 6

Author Comment

by:naughtynat
ID: 40476715
Thanks,

Sorry I think I wasnt very clear, is there a way to replace the field in the document.

I have in the document both IPADDRESS and 1IPADDRESS.

I want to change any field variables that are looking at "IPADDRESS" to be changed to "1IPADDRESS"

Not sure if that makes sense.
0
 
LVL 6

Accepted Solution

by:
Let's Go earned 500 total points
ID: 40477841
I think this is what you want:

1. Display all field names (e.g. ctrl-a to select the whole document, then shift-F9 to display field names)

2. Use search and replace to make the change you want.  You should search for both
DOCPROPERTY(space)IPADDRESS

Open in new window

and
DOCPROPERTY(space)(space)IPADDRESS

Open in new window

where (space) refers to pressing the space bar, and replace with
DOCPROPERTY(space)1IPADDRESS

Open in new window


Note: If IPADDRESS is only ever used in DOCPROPERTY fields, then you could just search-and-replace for IPADDRESS.

3. Reverse step 1 to show field results (e.g. again press ctrl-a to select the whole document, then shift-F9 to display field names)

If you want, you could put this into a macro.
Clipboard01.jpg
0
 
LVL 6

Author Closing Comment

by:naughtynat
ID: 40489216
Thanks very much, that has done the job very nicely :-)
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question