#1
|
|||
|
|||
Word adds additional stupid \* MERGEFORMAT
Hi to all,
I never ever use the \* MERGEFORMAT switch in e.g. { REF } fields, I use \* CHARFORMAT instead. But if whatever character formatting is applied, Word adds the \* MERGEFORMAT switch - even in addition to an existing \* CHARFORMAT. I really never noticed that before . In the undo list the last two steps (in reverse order) are 1. "Character formatting" and 2. "Update automatically" (maybe the English terms are slightly different). Undo "Update automatically" removes the inserted \* MERGEFORMAT. As I do not like to have any \* MERGEFORMAT switch in my documents my question: Can I stop Word from inserting that stupid switch? Thanks in advance NP |
#2
|
|||
|
|||
I don't know that it is possible to completely eliminate it. However, the following code sets the default when you add a field through Insert>Quick Parts>Fields is to have the box to insert it uinchecked.
I have it installed in an Add-In. Code:
Sub InsertField() ' Graham Mayor vba samples ' Intercepts InsertField command and removes MERGEFORMAT default ' Allows CHARFORMAT switch option ' Dim oRng As Range, i As Variant, sSwitch As String, strChoice As String ' ' Uncheck box to insert MERGEFORMAT ' SendKeys "{Tab 2} +{Tab 2}" ' Dialogs(wdDialogInsertField).Show On Error GoTo Finish 'User has cancelled ' Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Set oRng = Selection.Range ' For i = 1 To oRng.Fields.Count With oRng.Fields(i) If InStr(1, .Code, "MERGEFORMAT") <> 0 Then sSwitch = MsgBox("Use charformat in place of the mergeformat switch?", _ vbYesNo, _ "Insert Field") If sSwitch = vbYes Then .Code.Text = Replace(.Code.Text, _ "MERGEFORMAT", _ "CHARFORMAT") End If End If .Update End With Next i Selection.MoveRight Unit:=wdCharacter, Count:=1 Finish: End Sub If you do check the box, it asks if you want CharFormat instead. |
#3
|
|||
|
|||
Hi Charles,
Thanks, for your answer, but that does not really solve my problem. I do in fact only use \* Charformat (use my own macros), but whenever I change e.g. the font size or use bold or italic formatting, a \* Mergeformat is added (even into a field with \* Charformat switch): { REF Name \* CHARFORMAT \* MERGEFORMAT } Unfortunately \* M seems so 'overrule \* C which means, first character \* C formatting doesn't work anymore. You can format the first character of the field, but the formatting will not take effect unless you delete the added \* M switch. When changing the character formatting, according to the undo list, two commands are carried out: a) formatting and b) field update (including adding the \* M switch). Any other ideas ? NP |
#4
|
||||
|
||||
Unfortunately, whenever you hard-format a cross-reference, Word 'helpfully' adds the MERGEFORMAT switch. The simplest solution is to toggle the field code display 'on' (e.g. via Alt-F9), then use Find/Replace to delete the switches, via:
Find = \* MERGEFORMAT<space> Replace = nothing Do note that, when adding the \* CHARFORMAT switch, you need only format the first character of the field code, in this case the 'R' of the field's 'REF' expression. There is no need to format anything else. Not applying the format to the whole field will avoid the addition of the extraneous \* MERGEFORMAT switch.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
Hi Paul,
Quote:
Quote:
Quote:
Quote:
Seem to be one of those features "resulting from far too many Tia Marias laced with vodka" (http://word.mvps.org/faqs/tblsfldsfms/FastTables.htm). NP |
#6
|
|||
|
|||
Quote:
|
#7
|
||||
|
||||
Without seeing your macro, I can't really comment on why it might be doing that.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Hi Paul,
Quote:
I stumpled upon this 'feature' it when applying the field solution (https://www.msofficeforums.com/word/...est-empty.html) to my table. When creating tables I often have to change table formatting until it fits my formatting ideas. Whenever I apply character formatting, the \* M switch is added to the { REF } fields. So I changed \* M to \*C, thought everything was fine and continued working. But Word still keeps inserting the \* M switch resulting in: { REF Text1 \* CHARFORMAT \* MERGEFORMAT }. As soon as the \* M switch is inserted, the \* C switch becomes ineffective. In the case of my table (and field formatting) it really does not matter, it is (was) more a sort of basic question. NP Last edited by NobodysPerfect; 10-13-2014 at 07:08 AM. |
#9
|
||||
|
||||
The problem, then, is that you're overriding the field's formatting when you change the table format. That's what's causing Word to add the \* MERGEFORMAT switch. IOW, it's behaving as intended.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
I get this {shape \*mergeformat} when I select org chart from the Drawing toolbar. | blockie | Word | 1 | 09-02-2014 02:15 PM |
stupid ? but the one I ask anyway | Rekitson | Excel | 2 | 04-19-2013 07:23 AM |
{ REF bmSubject \* MERGEFORMAT} In footer | shodg001 | Word | 2 | 04-17-2013 11:49 PM |
My list of stupid questions | Niinie | PowerPoint | 1 | 10-05-2010 02:34 PM |
Help - Word adds secret code? Copy to notepad? | andytaylor2006 | Word | 0 | 12-15-2006 11:00 PM |