Created
January 16, 2017 10:39
-
-
Save japborst/439e75e8708455ba17e0c8fd204a8c90 to your computer and use it in GitHub Desktop.
Simple cross-reference macros for auto selecting appropriate boxes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Because inserting cross-references is terrible in Word, these macros | |
' makes life a little easier by selecting the appropriate drop-down boxes | |
' Open issue: NumLock may be disabled | |
Sub InsertFigureReference() | |
' Reference a Figure and insert Only label and number | |
With Application.Dialogs(wdDialogInsertCrossReference) | |
SendKeys "ff{TAB}{DOWN 2}{ENTER}", True | |
.InsertAsHyperLink = 1 | |
.InsertPosition = 0 | |
.Show | |
End With | |
End Sub | |
Sub InsertEqReference() | |
' Reference an Equation and insert Entire caption | |
With Application.Dialogs(wdDialogInsertCrossReference) | |
SendKeys "eq{TAB}{DOWN 0}{ENTER}", True | |
.InsertAsHyperLink = 1 | |
.InsertPosition = 0 | |
.Show | |
End With | |
End Sub | |
Sub InsertTableReference() | |
' Reference a Table and insert Only label and number | |
With Application.Dialogs(wdDialogInsertCrossReference) | |
SendKeys "t{TAB}{DOWN 2}{ENTER}", True | |
.InsertAsHyperLink = 1 | |
.InsertPosition = 0 | |
.Show | |
End With | |
End Sub | |
Sub InsertHeadingReference() | |
' Reference a Heading and insert heading number | |
With Application.Dialogs(wdDialogInsertCrossReference) | |
SendKeys "hh{TAB}{DOWN 3}{ENTER}", True | |
.InsertAsHyperLink = 1 | |
.InsertPosition = 0 | |
.Show | |
End With | |
End Sub | |
Sub InsertAppendix() | |
' Reference a Numbered Item and insert Paragraph number | |
With Application.Dialogs(wdDialogInsertCrossReference) | |
SendKeys "n{TAB}{DOWN 2}{ENTER}{TAB 3}", True | |
.InsertAsHyperLink = 1 | |
.InsertPosition = 0 | |
.Show | |
End With | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a brilliantly straightforward solution to this considerable inadequacy in Word. Well done, mate. Many thanks.