Insert Cross Reference Macro and Dialog Box

Posted on 2005-05-17
Medium Priority
Last Modified: 2008-02-01
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!

Question by:Joanne M. Orzech
1 Comment
LVL 37

Accepted Solution

Joanne M. Orzech earned 0 total points
ID: 14021021
Oh - I found my own answer:

   With Dialogs(wdDialogInsertCrossReference)
      SendKeys "%th"
      SendKeys "{enter}"
      SendKeys "%p"
      SendKeys "{enter}"
      SendKeys "%h"
   End With



Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question