A family of Microsoft word processing software products for creating web, email, and print documents.
Your macro inserts and formats a cross reference to an endnote? e.g.
{ PAGEREF _Ref297715504 \p \h \* CHARFORMAT }
If as your question indicates you want to insert a reference to a Figure
{ REF _Ref297716129 \h \* CHARFORMAT }
then I guess you will need
Sub InsertFigRef()
Dim i As Long
Dim oRng As Range
Dim oFld As Range
Set oRng = Selection.Range
ActiveWindow.View.ShowFieldCodes = False
With Dialogs(wdDialogInsertCrossReference)
SendKeys " {HOME}{DOWN 6}{TAB} {HOME}{DOWN}{TAB 3}%(h)"
.Show
End With
On Error Resume Next
oRng.MoveEnd wdWord, 1
With oRng.Fields(1)
If Err.Number = 5941 Then Exit Sub
.Code.Text = .Code.Text & " \* CHARFORMAT "
.Update
End With
oRng.Style = "CrossRef"
End Sub
The part of your code about Mergeformat is unnecessary as the reference tool does not add the mergeformat switch, so you can simply add a charformat switch. CrossRef will have to be a character style.
Check the sendkeys statement to ensure that it does choose the options you really want