Advertisement
Guest User

Untitled

a guest
May 6th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Sub addCrossRefernce()
  2. Dim n As String
  3. On Error GoTo noReference
  4. tryAgain:
  5. n = InputBox("enter number of equation to refer!")
  6. If n <> "" Then
  7. Selection.InsertCrossReference ReferenceType:="Equation", ReferenceKind:= _
  8. wdOnlyLabelAndNumber, ReferenceItem:=n, InsertAsHyperlink:=True, _
  9. IncludePosition:=False, SeparateNumbers:=False, SeparatorString:=" "
  10. End If
  11. Exit Sub
  12. noReference:
  13. Err.Clear
  14. If MsgBox("There is no equation " & n & " in the document, do you want to enter another number?", _
  15. vbYesNo) = vbYes Then
  16. GoTo tryAgain
  17. End If
  18. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement