![]() |
ComboBox in a Userforn to display a column...
ok...what I am trying to do is:
1. Pull column (B) data into "getinfo" (userform) into ComboBox1... 2. When a name is picked from the ComboBox1, it pulls the associated row data... (i.e. Employee Number, ClassRoom, etc) and places it into labels also in the userforn to view (but not to edit)... 3. Click a button that will open a MSWord document and take that data and place it into specific insert fields If you email me at: is will send you my working file so you can review my code and pointing out what I am doing wrong. Thanks a lot. |
ComboBox in a Userforn to display a column...
ok...here is my code...
.................................................. ............................. Private Sub OpenWORDButton_Click() Dim WordObj As Object, FileNm As String Dim Doc As Object Err.Clear On Error Resume Next Set WordObj = GetObject(, "Word.Application") If Err.number = 429 Then Set WordObj = CreateObject("Word.Application") End If FileNm = "j:\database\Template.doc" WordObj.Visible = True WordObj.Activate Set Doc = WordObj.Documents(FileNm) If Doc Is Nothing Then Set Doc = WordObj.Documents.Open(FileNm) End If On Error GoTo 0 End Sub Private Sub ComboBox1_Change() Dim employeename As String Dim employeeno As String Dim employeeclass As String ComboBox1.RowSource = employeename.Value r = 2 Do While Cells(r, 1) < "" If Cells(r, 2) = employeename Then getinfo.employeeno = Cells(r, 1) getinfo.employeeclass = Cells(r, 3) Exit Do End If r = r + 1 Loop End Sub .................................................. ........................................ "stump5150" wrote: ok...what I am trying to do is: 1. Pull column (B) data into "getinfo" (userform) into ComboBox1... 2. When a name is picked from the ComboBox1, it pulls the associated row data... (i.e. Employee Number, ClassRoom, etc) and places it into labels also in the userforn to view (but not to edit)... 3. Click a button that will open a MSWord document and take that data and place it into specific insert fields If you email me at: is will send you my working file so you can review my code and pointing out what I am doing wrong. Thanks a lot. |
All times are GMT +1. The time now is 02:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com