Form Combobox Problem

GBOB

New Member
Joined
Mar 6, 2002
Messages
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
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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.
 
Upvote 0
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!
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,089
Members
448,548
Latest member
harryls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top