Insert Cross Reference Macro and Dialog Box

I wrote a mini macro as follows:

Sub InsertXRef()
    Application.Run MacroName:="InsertCrossReference"
    Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
    Selection.Font.Bold = wdToggle
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.Style = ActiveDocument.Styles("Default Paragraph Font")
End Sub

It merely shows the cross-reference dialog and makes the inserted cross reference bold.

However, I can't get the box that says "Insert As Hyperlink" to stay checked when I run the macro.

If I click Insert, Cross Reference, the box is checked.
If I click Alt F8 and run the Insert Cross Reference macro, the box is checked.

But if I click my toolbar button that runs the above macro, the box is unchecked.
If I run the following line of code, the box is unchecked.

I can't figure out a way to keep that option checked - we always want to insert the cross reference as a hyperlink.  I've never run across this before so I need your help.

Thanks in advance!

LVL 37
Joanne M. OrzechManager, Document Services CenterAsked:
Who is Participating?
Joanne M. OrzechConnect With a Mentor Manager, Document Services CenterAuthor Commented:
Oh - I found my own answer:

   With Dialogs(wdDialogInsertCrossReference)
      SendKeys "%th"
      SendKeys "{enter}"
      SendKeys "%p"
      SendKeys "{enter}"
      SendKeys "%h"
   End With;en-us;209668

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.