Share via

Adding "Insert Cross-Reference" to selected text in Right Click Menu

Anonymous
2021-01-27T12:10:44+00:00

Hello, 

I am using Office 365. I want to add "insert cross-reference" option in the right-click menu to the selected text in MS Word. 
I have no experience of Macro so anyone please guide me how can I do it?

Thank you.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2021-01-28T00:08:12+00:00

    All Charles and Doug say are true, but to add the button it is just a matter of:

    Sub AddButtonToTextSCMenu()
    Dim oBtn As CommandBarButton
      'Make changes to the Add-In template
      CustomizationContext = ThisDocument.AttachedTemplate
      'Prevent double customization
      Set oBtn = CommandBars.FindControl(Tag:="custCRBtn")
      If Not oBtn Is Nothing Then oBtn.Delete
      Set oBtn = CommandBars("Text").Controls.Add(msoControlButton, , , 1) 'Added to top of menu.
      With oBtn
        .Tag = "custCRBtn"
        .FaceId = 774
        .Caption = "Insert Cross Reference"
        .Style = msoButtonIconAndCaption
        'Identify the module and procedure to run when your button is clicked.
        .OnAction = "InsertCR"
      End With
      If MsgBox("This action caused a change to your Add-In template." _
         & vbCr + vbCr & "Recommend you save those changes now.", vbInformation + vbOKCancel, _
         "Save Changes") = vbOK Then
        ThisDocument.Save
      End If
      Set oBtn = Nothing
    lbl_Exit:
      Exit Sub
    End Sub
    Sub InsertCr()
      CommandBars.ExecuteMso ("CrossReferenceInsert")
    lbl_Exit:
      Exit Sub
    End Sub

    Was this answer helpful?

    0 comments No comments
  2. Doug Robbins - MVP - Office Apps and Services 323K Reputation points MVP Volunteer Moderator
    2021-01-27T22:03:11+00:00

    You description suggests that you are wanting to cross reference the selected text.  That is not the way that cross references work and the cross reference must be set up from the location where you want it to appear.  To be able to be cross referenced the text must conform to one of the Reference types that appear in the Reference type dropdown in the Cross-reference dialog.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2021-01-27T12:56:00+00:00

    Hello,

    This is not simple, but it can be done. The page that tells how to do this is:

    http://gregmaxey.com/word_tip_pages/customize_s...

    Frankly, I'm not sure this is a beginner project.

    Far easier would be to create a keyboard shortcut or to modify the Quick Access Toolbar for this. Here are pages discussing these options:

    https://answers.microsoft.com/en-us/msoffice/fo...

    http://addbalance.com/word/QATmodification.htm


    These are links to pages on one or more pages on my website and on one or more sites that I personally trust and vouch for. Those pages contain accurate safe information that I think will help you. However, as an Independent Advisor I am required to give the following notice when providing non-Microsoft links, even to my own site :


    Required Notice: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.


    This forum is a user-to-user support forum. I am a fellow user.

    I hope this information helps.

    Please let me know if you have any more questions or require further help.

    You can ask for more help by replying to this post (Reply button below).

    Stay well

    Was this answer helpful?

    0 comments No comments