#1
|
|||
|
|||
double spaces in field ref (bookmarks)
A Ref field in Word (e.g. a bookmark) seems to have sometimes 2 consecutive spaces in its "definition". I was wondering if those 2 spaces are normal, useful and necessary. Here is an example I have: { REF _Ref277582702 \h \* MERGEFORMAT } You can see two spaces after the \h switch. If I remove one space, the bookmark is still working fine, but I am not sure if I am "allowed" to remove this space or not. I didn't find anything about it in the references on bookmarks and Ref fields. If those 2 spaces are necessary, I will need help detecting in VBA how to find out that the cursor is in such a field or not. |
#2
|
||||
|
||||
With most fields, deleting extra spaces will do no harm. But with some calculated fields, or fields containing nested IF field constructs, the absence or presence of extra spaces may be crucial.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional Last edited by Stefan Blom; 10-25-2011 at 10:14 AM. |
#3
|
||||
|
||||
Hi Glencoe,
The field code you posted could be reduced to {REF _Ref277582702 \h} without harm. In general, the internal spacing within a simple field is inconsequential. Three exceptions are QUOTE, EQ and IF fields. With QUOTE and IF fields, double spaces between the double-quotes used to delimit the output will appear there. Other spaces in those field codes are inconsequential. With EQ fields, you generally need to ensure there are no spaces either side of the field code. With IF fields and other calculation fields, omitting the wrong spaces can have deleterious effects on how the expressions are evaluated and, hence, on their output - as Stefan says, their presence may be crucial.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Thanks Stefan and macropod for your answers. I have to check whether I need to work with QUOTE fields or not. My concern is that I am using a macro that deletes all double spaces in a Word file (and keeps only one space). In the example I gave, I didn't notice any harm indeed, but if, as you say, QUOTE fields or other kinds do need double spaces, then I will probably need to take care of this!
|
Tags |
double space, field ref |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Get rid of leading spaces before paragraphs | fig000 | Word | 11 | 03-14-2016 01:59 PM |
HELP - problem with disappearing spaces | klanch | Word | 3 | 02-11-2011 10:32 AM |
Eliminate blanc spaces at the beginnig row | Il_Fabietto | Word VBA | 9 | 06-26-2009 05:04 AM |
Spaces After Each Word | jnutella | Word | 0 | 03-04-2009 02:00 PM |
Word to Excel hyperlinks and spaces | gak | Word | 1 | 09-14-2008 08:38 AM |