R
Richardt
I have a protectet document with formfields. The users need som help
and the helpmethod in formfields is not good enough (the users don't
se it). So I thougt of the comment object. It is perfect if you use
the mouse to select the formfields, but the users of cause use the
Tabkey (which is good *S*).
I have the code to use the comments in af msgbox (MsgBox
ActiveDocument.Comments(nr).Range), but then the user needs to press
the msgbox and they will pretty shure get tired of that after a short
time. So...
I have made this code, where I find the bookmark in the actual
formfield (ex. Komm_2 where 2 is the indexnummer of the comment). The
code will run when entering the formfield.
Sub Kommentar()
Dim nr As Integer
'Finder det aktive formularfelts bogmærke
If Selection.FormFields.Count = 1 Then
'No textbox but a check- or listbox
Svar = Selection.Bookmarks(Selection.Bookmarks.Count).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count >
0 Then
Svar = Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If
StartPos = InStr(1, Svar, "_", vbTextCompare)
nr = Mid(Svar, StartPos + 1)
MsgBox ActiveDocument.Comments(nr).Range
End Sub
and the helpmethod in formfields is not good enough (the users don't
se it). So I thougt of the comment object. It is perfect if you use
the mouse to select the formfields, but the users of cause use the
Tabkey (which is good *S*).
I have the code to use the comments in af msgbox (MsgBox
ActiveDocument.Comments(nr).Range), but then the user needs to press
the msgbox and they will pretty shure get tired of that after a short
time. So...
I have made this code, where I find the bookmark in the actual
formfield (ex. Komm_2 where 2 is the indexnummer of the comment). The
code will run when entering the formfield.
Sub Kommentar()
Dim nr As Integer
'Finder det aktive formularfelts bogmærke
If Selection.FormFields.Count = 1 Then
'No textbox but a check- or listbox
Svar = Selection.Bookmarks(Selection.Bookmarks.Count).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count >
0 Then
Svar = Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If
StartPos = InStr(1, Svar, "_", vbTextCompare)
nr = Mid(Svar, StartPos + 1)
MsgBox ActiveDocument.Comments(nr).Range
End Sub