View Single Post
 
Old 12-21-2022, 04:30 AM
austria130 austria130 is offline Windows 11 Office 2019
Novice
 
Join Date: Dec 2022
Posts: 8
austria130 is on a distinguished road
Default Userform listbox reading from external excel

Hi guys,

unfortunately i do not know how to code and never worked with VBA. I spent several hours of reading and watching documents/tutorials/videos about this but cant figure out how to get the results i wish for.

I tried to follow the tutorial here: Create & Employ a Userform

I also clicked through and found exactly a guide on populating from external excel worksheet but still failed...

What i want:

I have a word template saved as .dotm which has several parts and is filled from many different people.
In one part i want a dropdown field where people can choose multiple selection (eg. item1 and item2 etc.). This multiselection should be printed into the spot in the document (i heared that it is easiest setting a bookmark to the spot i wish the output being printed to). The population of the listbox (dropdown) should be automatically retreived from an external excel with 1 column but many rows (n=100-300 entries).



What i managed so far:

Set a bookmark in the document i want my output at (bookmark name= bookmark1)
Created a userform with an "ok" and "cancel" button and a listbox

My Cancel command button
Code:
Private Sub cmdCancel_Click()
Me.Hide
End Sub

Module code to show the userform
Code:
Sub CallUF()
Dim oFrm As frmSurvey
  Set oFrm = New frmSurvey
  oFrm.Show
  Unload oFrm
  Set oFrm = Nothing
lbl_exit:
  Exit Sub
End Sub


And the rest was just trial and error by copying from multiple sources and nothing worked for me

Can anyone do a a step by step guide in plain language for non coders. Also i would like to understand the code for future adaptation

Thank you very much !
Reply With Quote