Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Bulk change "Field" variable in Word

Posted on 2014-11-30
5
321 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 50

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

856 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