English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a combox box with a list of dates. I would like to assign a macro to each date so that when it's selected the macro automatically runs.

Is this possible?

2007-11-19 04:21:05 · 2 answers · asked by Hector Victorious 2 in Computers & Internet Programming & Design

2 answers

Yes, it's easily possible. But normally you would use one macro and use the list index for the combo box to tell which date was picked. You could use the date or value, but it normally makes more sense to use the list index to tell exactly which one was picked. I would use the Click even procedure for the Combo Box to determine that the selection was made. If you already have the other macros written you can just use a Call or Run procedure to run the other macros.

2007-11-19 22:40:34 · answer #1 · answered by devilishblueyes 7 · 1 0

so on the combobox.change macro, just have an if..then for each date, and under that if..then call a macro

i.e.

if combobox.text = "1/1/07" then call 1107
if combobox.text = "1/2/07" then call 1207

then you would write the macros for 1107 and 1207

alternatively, you could write all the macros in the combobox.change section, and use a tracking variable to pick the right one, i.e.

tracker = combobox.text

if tracker="1/1/07" then
[macro 1107 code]
end if

if tracker="1/2/07" then
[macro 1207 code]
end if

2007-11-19 12:27:33 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers