P
PeterEvans
I have a program that displays autotext entry names in a userform in a
listbox. The user can then scroll through the list, or use arrows or
type the autotext name to select the entry they want. And then click a
button to insert this as a Comment or insert it inline in the
document.
This all works well and you can see a screen image image at:
http://baker-evans.com/emarking-assistant
<b>The problem is that when a new autotext entry is defined and the
comment picker is loaded the diaplayed entries are not in alphabetical
order. How can I sort them into alph order before loading them in to
the comment picker?</b>
Thanks in advance for any assistance,
PeterEvans
The code that loads the autotext enteries into the comment picker is
shown below:
Public Sub showCommentPicker()
Dim i As Long
Dim UFrm As AutoTextPicker
Set UFrm = New AutoTextPicker
With UFrm
.Show
End With
'load the autotext comments
Dim myAutoTextEntries As AutoTextEntries
For i = 1 To NormalTemplate.AutoTextEntries.Count
With NormalTemplate.AutoTextEntries(i)
'If Mid(.name, 1, 1) = "." Then
'only show it if there is the name starts with a .
UFrm.cmbAutotext.AddItem .name
UFrm.cmbAutotext.List(UFrm.cmbAutotext.ListCount - 1,
1) = .Value
'End If
End With
Next i
UFrm.refnum = "1"
End Sub
The code for inserting the autotext as a comment or as a text is shown
below
Private Sub cmdInsertComment_Click()
Dim oRng As Word.Range
Dim oCom As Comment
Dim thetitle As String
Dim themessage As String
Set oCom = ActiveDocument.Comments.Add(Range:=Selection.Range,
text:="")
NormalTemplate.AutoTextEntries(autoTextItemNum).Insert oCom.Range,
True
End Sub
Private Sub cmdInsertText_Click()
Dim newtext As String
NormalTemplate.AutoTextEntries(autoTextItemNum).Insert
Where:=Selection.Range, RichText:=True
End Sub
thanks to the people who contributed ideas in
http://groups.google.com/group/micr...en&lnk=gst&q=autotext+window#b7dea7f47ca73da2
listbox. The user can then scroll through the list, or use arrows or
type the autotext name to select the entry they want. And then click a
button to insert this as a Comment or insert it inline in the
document.
This all works well and you can see a screen image image at:
http://baker-evans.com/emarking-assistant
<b>The problem is that when a new autotext entry is defined and the
comment picker is loaded the diaplayed entries are not in alphabetical
order. How can I sort them into alph order before loading them in to
the comment picker?</b>
Thanks in advance for any assistance,
PeterEvans
The code that loads the autotext enteries into the comment picker is
shown below:
Public Sub showCommentPicker()
Dim i As Long
Dim UFrm As AutoTextPicker
Set UFrm = New AutoTextPicker
With UFrm
.Show
End With
'load the autotext comments
Dim myAutoTextEntries As AutoTextEntries
For i = 1 To NormalTemplate.AutoTextEntries.Count
With NormalTemplate.AutoTextEntries(i)
'If Mid(.name, 1, 1) = "." Then
'only show it if there is the name starts with a .
UFrm.cmbAutotext.AddItem .name
UFrm.cmbAutotext.List(UFrm.cmbAutotext.ListCount - 1,
1) = .Value
'End If
End With
Next i
UFrm.refnum = "1"
End Sub
The code for inserting the autotext as a comment or as a text is shown
below
Private Sub cmdInsertComment_Click()
Dim oRng As Word.Range
Dim oCom As Comment
Dim thetitle As String
Dim themessage As String
Set oCom = ActiveDocument.Comments.Add(Range:=Selection.Range,
text:="")
NormalTemplate.AutoTextEntries(autoTextItemNum).Insert oCom.Range,
True
End Sub
Private Sub cmdInsertText_Click()
Dim newtext As String
NormalTemplate.AutoTextEntries(autoTextItemNum).Insert
Where:=Selection.Range, RichText:=True
End Sub
thanks to the people who contributed ideas in
http://groups.google.com/group/micr...en&lnk=gst&q=autotext+window#b7dea7f47ca73da2