![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 17
|
Hi all,
Can't figure this out. I have a combo box from the excel forms toolbar. From the combobox I call document names from a database into a cell (m14 in code below) using index and match functions.The macro behind the combo box then opens the selected document on the selection click. My problem is that if the combobox is on a particular selection (say file abc.xls), I cannot open that file until I have selected a different file (say file def.xls to in effect reset the combo box. How do I get the combo box to work on the current selection without the 'reset'? Thanks! My code behind the forms toolbar cbox is below: Sub OpenGrant() Dim Filename As String On Error GoTo errtrap Filename = Range("m14").Text Workbooks.Open Filename:=Filename Sheets("Main Menu").Select Range("A8").Select Exit Sub errtrap: Dim nofilemsg nofilemsg = MsgBox("No File Exists Please See Coordinator Information", vbOKOnly + vbExclamation, "System Alert") End Sub |
|
|
|
|
|
#2 |
|
New Member
Join Date: Mar 2002
Posts: 17
|
Any thoughts on this one? Thanks again! |
|
|
|
|
|
#3 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi
Not too sure I have understood you but I would think you would be better of using a ComBobox from the Control toolbar. These have many Events that will allow you to trap the you current selection. |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Posts: 17
|
Dave,
Thanks for the response. I have tried changing it to a control toolbar cbox, and it still is not capturing the current selection. Is there something under properties for the cbox I should change? Thanks! |
|
|
|
|
|
#5 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
GBOB
Use the Control toolbar to go into Edit mode, then double click the ComboBox and place in this. Private Sub ComboBox1_Change() If ComboBox1.ListIndex > -1 Then MsgBox ComboBox1 End If End Sub |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|