Reputation: 1
This case statement is failing...it is like it never even sees it any help would be greatly appreciated.
Dim Runmode
Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("D:\Program Files (x86)\Logility\SPC8.0\Input\FG352F.txt",1)
RunMode = objFileToRead.ReadAll()
objFileToRead.Close
Set objFileToRead = Nothing
MsgBox(RunMode)
select Case RunMode
Case "D"
Set oShell = CreateObject("WSCript.shell")
oShell.run "D:\Scripts\RTL_DAILY.bat"
Case "W"
Set oShell = WScript.CreateObject("WSCript.shell")
oShell.run "D:\Scripts\RTL_WEEKLY.bat"
Case "M"
Set oShell = WScript.CreateObject("WSCript.shell")
oShell.run "D:\Scripts\RTL_MONTHLY.bat"
End Select
Upvotes: 0
Views: 151
Reputation: 38755
Assuming the file contains a single letter like "M" and perhaps an EOL, use .ReadLine() to get rid of the EOL automagically.
In general, a Case Else to catch (and dump) surprises is always a good idea.
Upvotes: 2