MergeFormat and CharFormat

alexransome

Board Regular
Joined
Jun 10, 2011
Messages
192
Hello,

I'm using a field code in a word document that references data in a spreadsheet.

The field code in the word document is ...

VBA Code:
LINK Excel.SheetMacroEnabled.12 "C:\\Users\\aransome\\Documents\\01.Auto\\Forms.xlsm" "VAF Word!R4C4:R13C4" \a \t\*CHARFORMAT

But I also have some code which is designed to then break the link before the file is then saved ...

VBA Code:
'Loop through fields
    For Each fld In doc.Fields
            If fld.Type = wdFieldLink Then fld.LinkFormat.BreakLink
    Next fld

However this code also adds a MERGEFORMAT tag into the link which once the code runs changes the formatting of the text in the word document.

Any ideas on how to overcome this issue?

Thanks for any help.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,223,667
Messages
6,173,683
Members
452,527
Latest member
ineedexcelhelptoday

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top