PDA

View Full Version : Solved: Multiple lines in msgbox



MrAshton
03-07-2008, 03:26 PM
In a message box, how can I enter more than one line of text. Right now, all I can do is put it all in one line. but I'd like to have a message box that shows like this.

"
Enter the numbers for the tests you want data for.
Seperate each test with a comma.

1 - Focus Model
2 - Sequencing Style
3 - Filter Vibration
"

I will probably have a follow up to any help with this issue, because I'd like to know, also, how to have VB know which numbers were entered

RonMcK
03-07-2008, 03:33 PM
Build your "msg" as one huge string and insert a vbCrLf wherever you want a line break. Thus, your example becomes:

msg = "" & vbCrLf & "Enter the numbers for the tests you want data for." & vbCrLf & "Seperate each test with a comma." & vbCrLF & vbCrLf & "1 - Focus Model" & vbCrLF & "2 - Sequencing Style" & vbCrLf & "3 - Filter Vibration"

MsgBox(Msg)

Pull up the VBE Help for MsgBox() and you'll see that there are some other options that you can use to pretty up your message box even more.

Cheers!

MrAshton
03-07-2008, 03:46 PM
Ok it displayed great as a message box, but I need it to be an input box so I wrote the following.
tests = Application.InputBox("" & vbCrLf & "Enter the numbers for the tests you want data for." & vbCrLf & "Seperate each test with a comma." & vbCrLf & vbCrLf & "1 - Focus Model" & vbCrLf & "2 - Sequencing Style" & vbCrLf & "3 - Filter Vibration")
When I did this, It now only shows up to "1 - Focus Model" and then has the input box right below it (instead of 2 and 3)

How can I get it to
a) still show the rest of the lines
b) recognize the delimiter so that it stores each value seperately so that later I can create if statements for each seperate value (I actually have 9 options). I'll need the user to put in, for example: 1,2,5,6,9. and I need the program to recognize each value seperately so I can only call the subs whose numbers were identified. I hope this question makes sense.

Tommy
03-07-2008, 03:47 PM
I would suggest you use a userform.

MrAshton
03-07-2008, 03:54 PM
ooo... a whole new realm for me.. this should be interesting lol. hopefully my basic understanding of Access might help...:think:

MrAshton
03-07-2008, 04:12 PM
I would suggest you use a userform.

Ok so I have the form designed lookin all nice and pretty. Now, how do I make the input recognize delimiters. Or would it be easier to add a check box next to each test and have the user check the boxes next to the tests whose results they want to retrieve. This would enable a if "t1box = true then" functionality for each test. Any suggestions which would be easier? I'll also need help with how to make the macro read which bozes are true and or false.. maybe.. I'm going to give it a shot and mess around, feel free to respond before I report back success or failure.

the help here rocks!

Tommy
03-07-2008, 04:13 PM
try this :) let me know if you need more help

MrAshton
03-07-2008, 04:21 PM
try this :) let me know if you need more help

lol... that didn't quite help I don't think. I've created a form in VBExcel to be used in conjunction with my macro. How do I link the form with my macro so that
a) the macro calls for the form to open
b) the macro stores which boxes were checked and which werent

I've scrapped the whole input text with delimiters Idea.

MrAshton
03-07-2008, 04:34 PM
Hey I've got it down. Thanks!

Tommy
03-07-2008, 08:47 PM
Well I'm back now so let us know how you did it :)

LOL you were posting while I was.

MrAshton
03-10-2008, 07:35 AM
OK I'm back at work and have a few problems to address but I will get to my VB soon enough. I'll let you know how it all goes.:beerchug:

MrAshton
03-10-2008, 01:36 PM
It works and it's sweet.
my colleagues love my new program. It essentually goes in and reads a bunch of CSV files and pulls the data and throws it into a sheet where it is analyzed with Pass/Fail results. Before, we had to view charts and eyeball various values and enter the data. Now, with my new program, we just select the tests we want data for, and it retrieves it. sweeeeeet.

Thanks for the help!