Hyperlink

J

jamalhakem

Hi
Any help?
I want to ibsert hyperlik in a line and the the link would be next to a
word some thing like:
computer (this is a machine), when I click to computer it goes to the
text in the brackets, and I want to hide the text in the bracket.
Thanks in advance
Jam
 
P

Peter Jamieson

Do you mean:
a. you start with

computer (this is a machine)

where
- "computer" is visible
- "(this is a machine)" is hidden
- the user can see that there is a link from "computer"

b. when the user clicks the link, "(this is a machine)" becomes
visible (and perhaps, is selected) ?

If not, can you spell it out?

However, although they are not commonly used, you might be better off
using Word's Smart Tag feture to achieve that kind of thing.

Peter Jamieson

http://tips.pjmsn.me.uk
 
P

Peter Jamieson

Instead, would it be enough just to put a "tooltip" in each hyperlink,
that displays a short text when the user mouses over the link? No
programming required, and it's more likely to work for more people
(here, for example, clicking or control-clicking on hyperlinks does
nothing - with my current set-up, I have to right-click and open the
link. But the tooltip would show up without setting up anything special,
unless the user had the tooltips switched off.

(NB I will probably be offline for a couple of days)

Peter Jamieson

http://tips.pjmsn.me.uk
 
P

Pesach Shelnitz

Hi,

I have a solution based on two macros, but it requires the users to have the
second macro (ShowGlossaryDefinition) installed. The first macro creates a
field that looks like a hyperlink and hides the text of the "glossary
definition." When the user double-clicks the pseudo-hyperlink created, a
message box containing the glossary definition appears. Try these macros and
see if they do what you want.

Sub CreateGlossaryEntry()
' This macro creates a glossary entry from
' text in the form "entry_name (definition)".
' A field of the form
' {Macrobutton ShowGlossaryDefinition entry_name {Private definition}}
' is created.
' Place the cursor within the entry name before
' running this macro.
Dim linkRange, hideRange As Range
Dim rngStart, rngEnd As Long
Dim entryName As String
Dim myField As Field

With Selection.Range
.MoveEnd unit:=wdWord
rngEnd = .End - 1
.Collapse Direction:=wdCollapseEnd
.MoveStart unit:=wdWord, Count:=-2
rngStart = .Start + 1
End With
Set linkRange = ActiveDocument.Range(Start:=rngStart, End:=rngEnd)
entryName = linkRange.Text
linkRange.Text = ""
With Selection.Find
.ClearFormatting
.Text = "("
.Forward = True
.Wrap = wdFindStop
.Execute
End With
rngStart = Selection.Start
Selection.Collapse Direction:=wdCollapseEnd
With Selection.Find
.ClearFormatting
.Text = ")"
.Forward = True
.Wrap = wdFindStop
.Execute
End With
rngEnd = Selection.End
Selection.Collapse Direction:=wdCollapseEnd
Set hideRange = ActiveDocument.Range(Start:=rngStart, End:=rngEnd)
hideRange.SetRange hideRange.Start + 1, hideRange.End - 1
linkRange.Select
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
Type:=wdFieldEmpty, PreserveFormatting:=False)
myField.Code.Text = "Macrobutton ShowGlossaryDefinition " & entryName
myField.Select
Selection.Font.Underline = wdUnderlineSingle
Selection.Font.Color = wdColorBlue
Selection.MoveRight unit:=wdCharacter, Count:=1
Selection.MoveLeft unit:=wdCharacter, Count:=1
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="PRIVATE " & hideRange.Text
hideRange.SetRange hideRange.Start - 1, hideRange.End + 1
hideRange.Font.Hidden = True
ActiveDocument.Fields(ActiveDocument.Fields.Count - 1). _
ShowCodes = False
Set linkRange = Nothing
Set hideRange = Nothing
Set myField = Nothing
End Sub

Sub ShowGlossaryDefinition()
MsgBox Prompt:=Mid(Selection.Fields(2).Code, 10), _
Title:="Glossary Definition"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top