简体   繁体   中英

How to display multiple variables in a pop-up prompt?

I have a VBA code where I compute the values of many variables (For simplicity, let's name them A, B, C).

I need to pop up a prompt a little more professional and involved than a MsgBox with multiple vbLines. For example, to have a frame that holds three boxes, each one displaying the value of one of the variables, and has a caption in it.

MsgBox seems too limited for this task. I tried a UserForm, but the controls available for UserForms are all Comboboxes, Listboxes, etc. Can I insert simple "Display Boxes" in a userform?

Furthermore, I will eventually need to have an additional box in that pop-up prompt where the user enters some value, clicks OK, then the value of the variables A, B, C are re-computed and updated in the display.

What tool do I need? Msgbox? dialogbox? userform? etc.

A userform is the way to go. You can display your variables in either labels or textboxes. You can group them using a Frame control. If the user-entered value is from a limited set, I'd go with a combobox, with MatchRequired set to true and calculation done on its Click event. If they can enter anything, then I'd use a textbox for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM