decadence
Well-known Member
- Joined
- Oct 9, 2015
- Messages
- 525
- Office Version
- 365
- 2016
- 2013
- 2010
- 2007
- Platform
- Windows
Hi I am using the code below to open programs if the user types in the correct word, however I'm not sure how to add an Or Statement or if I need to add individual words to be found. Can someone help with this please.
So for example I want to these optional words to be used in the CASE statement, "Calc" Or "Cal" Or "Calculator"
So for example I want to these optional words to be used in the CASE statement, "Calc" Or "Cal" Or "Calculator"
Code:
Option Explicit
Dim retVal As String
Sub MyTest()
'
Dim addStr As String
addStr = InputBox("Open...", "Open Program")
If addStr = UCase(addStr) Or addStr = LCase(addStr) Or addStr = StrConv(addStr, vbProperCase) Then
addStr = StrConv(addStr, vbProperCase)
End If
If addStr = vbNullString Then Exit Sub
Select Case addStr
Case Is = "Word"
retVal = Shell("WINWORD.EXE", vbMaximizedFocus)
Case Is = "Calc"
retVal = Shell("calc.exe", vbMaximizedFocus)
End Select
End Sub
Last edited: