Discussion Locked

Outlook code select case

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am creating a custom form in Outlook and it will need to make a selection based on what is entered into another text box.
Here is a sample of my code, I can get it to work with if statements but I need to be able to use a Select statement.

*'This part will work
If strTest = "E" Then
Item.GetInspector.ModifiedFormPages("test").txtClass.Text= "Class One"

If strTest = "D" Then
Item.GetInspector.ModifiedFormPages("test").txtClass.Text= "Class Two"
End If
End If

'this one does not work
Select Case strClassDescription
Case 1
strTest = "E"
Item.GetInspector.ModifiedFormPages("test").txtClass.Text= "Class One"

Case 2
strTest = "D"
Item.GetInspector.ModifiedFormPages("test").txtClass.Text= "Class One"

How can I get a selct Case to work
Dennis

3 replies

by madestroitsolutions

Well, you are writing two different things here my friend. If you want the SELECT CASE to do the same thing you are doing up there with the IFS, then this is what you would be looking at:

SELECT CASE strTest

Case "E"
Item.GetInspector.ModifiedFormPages("test").txtClass.Text= "Class One"

Case "D"
Item.GetInspector.ModifiedFormPages("test").txtClass.Text= "Class Two"

END SELECT

---------------------------------------------

I hope that helps, good luck!

This discussion is closed to new replies.