L
LittleAnn
Hi
I have 5 multi-column listboxes on my Template, which enter the abbreviation
of the word that is selected on each listbox into my document rather then the
word itself.
I set up a button so that the user could recall the userform in order to
edit any mistakes they initially inputted into the form, which works fine,
all the information returns to the Userform i.e. all text boxes, listboxes,
combo box.
My problem is that once the document is saved and closed, when the user
opens the document again and wants to make further changes and presses the
recall userform button, all the information that was entered initially goes
back into the form except for the listbox entries.
I have tried a few different codes but still nothing works. Any Help would
greatly be appreciated. I have posted what I have so far on the code below.
thanking you in advance.
In the Userform Option Explicit section I have for the list box entries and
combo box as follows:
Private Sub Userform_Initialize()
Dim myArray1 As Variant
Dim myArray2 As Variant
Dim myArray3 As Variant
Dim myArray4 As Variant
Dim myArray5 As Variant
Dim myArray6 As Variant
Dim myArray7 As Variant
Dim myArray8 As Variant
Dim myArray9 As Variant
Dim myArray10 As Variant
Dim i As Long
Dim j As Long
Dim k As Long
Dim l As Long
Dim m As Long
myArray1 = Split("Select Identifier|AdeH|EBT|" & "Rail|Rail Procurement",
"|")
myArray2 = Split(" |AH|ES|IE|RP", "|")
With Me.Identifier
.ColumnWidths = "60;0"
For i = 0 To UBound(myArray1)
.AddItem
.List(i, 0) = myArray1(i)
.List(i, 1) = myArray2(i)
Next i
End With
myArray3 = Split("Select Team|Architecture|Assurance|" & "Civil and
Structural Engineering|Construction Planning|Cost Management", "|")
myArray4 = Split(" |ARC|ASS|" & "CAS|CPL|COS|" , "|")
With Me.Team
.ColumnWidths = "60;0"
For j = 0 To UBound(myArray3)
.AddItem
.List(j, 0) = myArray3(j)
.List(j, 1) = myArray4(j)
Next j
End With
myArray5 = Split("Select Zone|Central|Station|Dock Station|Tie-In|" , "|")
myArray6 = Split("|CE|CS|DS|ET|", "|")
With Me.Zone
.ColumnWidths = "60;0"
For k = 0 To UBound(myArray5)
.AddItem
.List(k, 0) = myArray5(k)
.List(k, 1) = myArray6(k)
Next k
End With
myArray7 = Split("Select Document Type|Agenda|Design
Calculation|Correspondence|Capital Cost Plan|" , "|")
myArray8 = Split("|AGN|CAL|COR|COS|", "|")
With Me.DocumentType
.ColumnWidths = "60;0"
For l = 0 To UBound(myArray7)
.AddItem
.List(l, 0) = myArray7(l)
.List(l, 1) = myArray8(l)
Next l
End With
Me.IssueSTATUS.Style = fmStyleDropDownList
Me.IssueSTATUS.BoundColumn = 0
With Me
.IssueSTATUS.AddItem "Select Status"
.IssueSTATUS.AddItem "Draft"
.IssueSTATUS.AddItem "Issue for Review"
.IssueSTATUS.AddItem "Issue for Approval"
.IssueSTATUS.AddItem "Issue for Information"
.IssueSTATUS.AddItem "FINAL"
End With
Me.IssueSTATUS.ListIndex = 0
End Sub
And for the Displaying of the Userform once recalled by the user I have the
following code (but the listbox entries work fine when the doc is still
opened but once saved, closed and reopened the list box entries do not
re-enter the userform):
Sub DisplayUserForm()
Dim oRng As Word.Range
Dim oBM As Bookmarks
Set oBM = ActiveDocument.Bookmarks
UserForm1.DocumentTitle.Text = oBM("DocumentTitle").Range.Text
UserForm1.Continued.Text = oBM("Continued").Range.Text
UserForm1.Identifier.List(i, 1) = oBM("Identifier").Range.Text
UserForm1.Team.List(j, 1) = oBM("Team").Range.Text
UserForm1.Zone.List(k, 1) = oBM("Zone").Range.Text
UserForm1.DocumentType.List(l, 1) = oBM("DocumentType").Range.Text
UserForm1.SeqNumber.Text = oBM("SeqNumber").Range.Text
UserForm1.Rev.Text = oBM("Rev").Range.Text
UserForm1.IssueDATE.Text = oBM("IssueDATE").Range.Text
UserForm1.IssueSTATUS.Text = oBM("IssueSTATUS").Range.Text
UserForm1.Show
End Sub
Thanks again for your help
I have 5 multi-column listboxes on my Template, which enter the abbreviation
of the word that is selected on each listbox into my document rather then the
word itself.
I set up a button so that the user could recall the userform in order to
edit any mistakes they initially inputted into the form, which works fine,
all the information returns to the Userform i.e. all text boxes, listboxes,
combo box.
My problem is that once the document is saved and closed, when the user
opens the document again and wants to make further changes and presses the
recall userform button, all the information that was entered initially goes
back into the form except for the listbox entries.
I have tried a few different codes but still nothing works. Any Help would
greatly be appreciated. I have posted what I have so far on the code below.
thanking you in advance.
In the Userform Option Explicit section I have for the list box entries and
combo box as follows:
Private Sub Userform_Initialize()
Dim myArray1 As Variant
Dim myArray2 As Variant
Dim myArray3 As Variant
Dim myArray4 As Variant
Dim myArray5 As Variant
Dim myArray6 As Variant
Dim myArray7 As Variant
Dim myArray8 As Variant
Dim myArray9 As Variant
Dim myArray10 As Variant
Dim i As Long
Dim j As Long
Dim k As Long
Dim l As Long
Dim m As Long
myArray1 = Split("Select Identifier|AdeH|EBT|" & "Rail|Rail Procurement",
"|")
myArray2 = Split(" |AH|ES|IE|RP", "|")
With Me.Identifier
.ColumnWidths = "60;0"
For i = 0 To UBound(myArray1)
.AddItem
.List(i, 0) = myArray1(i)
.List(i, 1) = myArray2(i)
Next i
End With
myArray3 = Split("Select Team|Architecture|Assurance|" & "Civil and
Structural Engineering|Construction Planning|Cost Management", "|")
myArray4 = Split(" |ARC|ASS|" & "CAS|CPL|COS|" , "|")
With Me.Team
.ColumnWidths = "60;0"
For j = 0 To UBound(myArray3)
.AddItem
.List(j, 0) = myArray3(j)
.List(j, 1) = myArray4(j)
Next j
End With
myArray5 = Split("Select Zone|Central|Station|Dock Station|Tie-In|" , "|")
myArray6 = Split("|CE|CS|DS|ET|", "|")
With Me.Zone
.ColumnWidths = "60;0"
For k = 0 To UBound(myArray5)
.AddItem
.List(k, 0) = myArray5(k)
.List(k, 1) = myArray6(k)
Next k
End With
myArray7 = Split("Select Document Type|Agenda|Design
Calculation|Correspondence|Capital Cost Plan|" , "|")
myArray8 = Split("|AGN|CAL|COR|COS|", "|")
With Me.DocumentType
.ColumnWidths = "60;0"
For l = 0 To UBound(myArray7)
.AddItem
.List(l, 0) = myArray7(l)
.List(l, 1) = myArray8(l)
Next l
End With
Me.IssueSTATUS.Style = fmStyleDropDownList
Me.IssueSTATUS.BoundColumn = 0
With Me
.IssueSTATUS.AddItem "Select Status"
.IssueSTATUS.AddItem "Draft"
.IssueSTATUS.AddItem "Issue for Review"
.IssueSTATUS.AddItem "Issue for Approval"
.IssueSTATUS.AddItem "Issue for Information"
.IssueSTATUS.AddItem "FINAL"
End With
Me.IssueSTATUS.ListIndex = 0
End Sub
And for the Displaying of the Userform once recalled by the user I have the
following code (but the listbox entries work fine when the doc is still
opened but once saved, closed and reopened the list box entries do not
re-enter the userform):
Sub DisplayUserForm()
Dim oRng As Word.Range
Dim oBM As Bookmarks
Set oBM = ActiveDocument.Bookmarks
UserForm1.DocumentTitle.Text = oBM("DocumentTitle").Range.Text
UserForm1.Continued.Text = oBM("Continued").Range.Text
UserForm1.Identifier.List(i, 1) = oBM("Identifier").Range.Text
UserForm1.Team.List(j, 1) = oBM("Team").Range.Text
UserForm1.Zone.List(k, 1) = oBM("Zone").Range.Text
UserForm1.DocumentType.List(l, 1) = oBM("DocumentType").Range.Text
UserForm1.SeqNumber.Text = oBM("SeqNumber").Range.Text
UserForm1.Rev.Text = oBM("Rev").Range.Text
UserForm1.IssueDATE.Text = oBM("IssueDATE").Range.Text
UserForm1.IssueSTATUS.Text = oBM("IssueSTATUS").Range.Text
UserForm1.Show
End Sub
Thanks again for your help