VB "Select Case" Syntax
VB "Select Case" Syntax
(OP)
Howdy All,
I'm trying to set up a VB Select Case construct and seem to be missing something.
Attached is a SW Macro I've been trying to set-up. I think I'm close or way-off
.
Can anyone help me with this?
Thanks
I'm trying to set up a VB Select Case construct and seem to be missing something.
Attached is a SW Macro I've been trying to set-up. I think I'm close or way-off
Can anyone help me with this?
Thanks
Tobin Sparks
www.nov.com






RE: VB "Select Case" Syntax
RE: VB "Select Case" Syntax
Thanks for your responce. I have been looking in all kinds of help files
Can anyone help?
Tobin Sparks
www.nov.com
RE: VB "Select Case" Syntax
CODE
Also, can't repeat values for Case statements (i.e. can't have two "Case 1" statements)
CODE
If Len(TextBox1.Text) = 0 And Len(TextBox2.Text) = 0 Then SelectOpt=0
' TextBox1 only
If Len(TextBox1.Text) > 0 And Len(TextBox2.Text) = 0 Then SelectOpt=1 ' TextBox2 only
If Len(TextBox1.Text) = 0 And Len(TextBox2.Text) > 0 Then SelectOpt=2' TextBox1 & TextBox2
If Len(TextBox1.Text) > 0 And Len(TextBox2.Text) > 0 Then SelectOpt=3
CODE
Case 0 ' NO Selected Options
MsgBox ("No Text entered! "), vbInformation, "Make Note2"
Case 1 ' TextBox1 only
Set AddNoteLines = swPart.InsertNote(Me.TextBox1)
Case 2 ' TextBox1 only
Set AddNoteLines = swPart.InsertNote(Me.TextBox2)
Case 3 ' TextBox1 & TextBox2
Set AddNoteLines = swPart.InsertNote(Me.TextBox1 & Me.TextBox2)
Case Else ' Catch all error
MsgBox ("Unknown Error"), vbInformation, "Make Note2"
End Select
RE: VB "Select Case" Syntax
Thanks for your response AGAIN!
Yes I was trying to use "SelectOpt(3)" as an Array.
Do you know how I can make it work that way?
Maybe it's not the best way to go in this situation.
I really appreciate your help.
Tobin Sparks
www.nov.com
RE: VB "Select Case" Syntax
P.S. you may want to add a space or carriage return when you concatenate the text boxes.
CODE
RE: VB "Select Case" Syntax
Thank you very much for all your help!
Tobin Sparks
www.nov.com