L
LittleAnn
I have created a template, set up a userform and added a list box, the
userform works fine with the TextBoxes but for some reason when the Userform
opens for the Userform, the listbox does nothing, i.e cant click into and it
does not show any data that I added to the below code, any ideas where I have
gone wrong??
Option Explicit
Private Sub UserForm1_Initialize()
Dim myArray1 As Variant
Dim myArray2 As Variant
Dim i As Long
myArray1 = Split("Select Identifier|Company Name 1|Company Name 2|" _
& "Company Name 3|Company Name 4", "|")
myArray2 = Split(" |1|2|3|4", "|")
Identifier.ColumnWidths = "60;0"
For i = 0 To UBound(myArray1)
ListBox.AddItem
ListBox.List(i, 0) = myArray1(i)
ListBox.List(i, 1) = myArray2(i)
Next i
End Sub
Private Sub CmdOK_Click()
Dim oRng As Word.Range
Dim oBM As Bookmarks
Set oBM = ActiveDocument.Bookmarks
Set oRng = oBM("DocumentTitle").Range
oRng.Text = DocumentTitle.Text
oBM.Add "DocumentTitle", oRng
Me.Identifier.TextColumn = 2
Set oRng = oBM("Identifier").Range
oRng.Text = Identifier.Text
oBM.Add "Identifier", oRng
Set oRng = oBM("IssueDATE").Range
oRng.Text = IssueDATE.Text
oBM.Add "IssueDATE", oRng
Set oRng = oBM("IssueSTATUS").Range
oRng.Text = IssueSTATUS.Text
oBM.Add "IssueSTATUS", oRng
Me.Hide
End Sub
userform works fine with the TextBoxes but for some reason when the Userform
opens for the Userform, the listbox does nothing, i.e cant click into and it
does not show any data that I added to the below code, any ideas where I have
gone wrong??
Option Explicit
Private Sub UserForm1_Initialize()
Dim myArray1 As Variant
Dim myArray2 As Variant
Dim i As Long
myArray1 = Split("Select Identifier|Company Name 1|Company Name 2|" _
& "Company Name 3|Company Name 4", "|")
myArray2 = Split(" |1|2|3|4", "|")
Identifier.ColumnWidths = "60;0"
For i = 0 To UBound(myArray1)
ListBox.AddItem
ListBox.List(i, 0) = myArray1(i)
ListBox.List(i, 1) = myArray2(i)
Next i
End Sub
Private Sub CmdOK_Click()
Dim oRng As Word.Range
Dim oBM As Bookmarks
Set oBM = ActiveDocument.Bookmarks
Set oRng = oBM("DocumentTitle").Range
oRng.Text = DocumentTitle.Text
oBM.Add "DocumentTitle", oRng
Me.Identifier.TextColumn = 2
Set oRng = oBM("Identifier").Range
oRng.Text = Identifier.Text
oBM.Add "Identifier", oRng
Set oRng = oBM("IssueDATE").Range
oRng.Text = IssueDATE.Text
oBM.Add "IssueDATE", oRng
Set oRng = oBM("IssueSTATUS").Range
oRng.Text = IssueSTATUS.Text
oBM.Add "IssueSTATUS", oRng
Me.Hide
End Sub