Dear Excel-gurus,
Having prowled the internet for well over an hour trying to find the solution, I come to you for help.
The situation is as follows: users add data to a userform which, once all is completed, produces a PDF document. One of the parts is to fill in terms and abbreviations used in the document. A number of which are always required, even more can be selected by the user and finally the user has the option to add non-standard terms and abbreviations to the document.
The userform therefore, amongst other buttons and things, has:
a 2-column listbox which needs to be populated automatically for the standard T&As;
a 2-column listbox for the optional T&As which the user selects using the multiselect option;
a textbox for the non-standard T&A shortcut;
a textbox for the non-standard T&A description;
a button for adding the non-standard, user-defined T&A (which is typed into the two textboxes);
a button for removing T&As from the top listbox.
The idea is that the main listbox be the one copied by VBA to the final document.
I have tried the commands .AddItem, .List, .Column, .RowSource, et cetera, but cannot find a working code. Like other people, when using RowSource, I get an access error.
Here are a few things I've tried:
Private Sub cmdTermsAbbsManualAdd_Click()
'ListBoxTermsAbbs.Column(1).AddItem TextBoxTermsAbbs.Value
'ListBoxTermsAbbs.List(ListBoxTermsAbbs.ListCount - 1, 0) = TextBoxTermsAbbs.Value
'ListBoxTermsAbbs.Column(2).AddItem TextBoxTermsAbbsDescription.Value
'ListBoxTermsAbbs.List(ListBoxTermsAbbs.ListCount - , 1) = TextBoxTermsAbbsDescription.Value
'ListBoxTermsAbbs.AddItem (TextBoxTermsAbbs.Value)
'ListBoxTermsAbbs.AddItem TextBoxTermsAbbsDescription.Value
Dim MyArray(1, 2)
MyArray(0, 1) = TextBoxTermsAbbs.Value
MyArray(0, 2) = TextBoxTermsAbbsDescription.Value
ListBoxTermsAbbs.List() = MyArray
End Sub
TermsAbbsUserform_edit.png
Bookmarks