![]() |
GUI in Excel Macro
Hi,
I need to get input from the user as to what kind of file (i.e. files with a specific file extension) he is interested in operating the macro on. I want to have a drop down menu with some file extension options for the user to choose from. Once the User chooses the file extension the macro should begin running (with the file extension information used in the macro). The file extension should be stored as a variable and passed on to the main macro. How can I implement this. Please help. Thanks Srikanth |
GUI in Excel Macro
Right click Forms, insert UserForm
Add a combobox to your form by dragging it from your tool box. Double click ThisWorkbook and enter: Private Sub Workbook_Open() userform1.ComboBox1.AddItem "txt" userform1.ComboBox1.AddItem "doc" userform1.ComboBox1.AddItem "xls" userform1.ComboBox1.AddItem "pdf" 'Use drop-down list userform1.ComboBox1.Style = fmStyleDropDownList 'Combo box values are ListIndex values userform1.ComboBox1.BoundColumn = 0 'Set combo box to first entry userform1.ComboBox1.ListIndex = 0 Load userform1 userform1.Show End Sub Double click your combobox and enter: Private Sub ComboBox1_Change() Dim strExtension As String strExtension = userform1.ComboBox1.Text 'insert your code, or call your module her End Sub "Srikanth Ganesan" wrote in message ... Hi, I need to get input from the user as to what kind of file (i.e. files with a specific file extension) he is interested in operating the macro on. I want to have a drop down menu with some file extension options for the user to choose from. Once the User chooses the file extension the macro should begin running (with the file extension information used in the macro). The file extension should be stored as a variable and passed on to the main macro. How can I implement this. Please help. Thanks Srikanth |
All times are GMT +1. The time now is 07:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com