Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using And with two InStr calls
#1
Anybody know how to make this work?  Maybe a 'Not InStr Xor InStr'?   My problem is InStr doesn't return true or false, but the position of the substring inside the string.  Maybe I need to rethink the whole structure.  I want to be able to default to -sh (run CreateSheet) if no option is given.

Code: (Select All)

If InStr(LCase$(opt$), "-sh") And InStr(LCase$(opt$), "-st") Then
    Print "-sh -st"
    CreateSheet sheet&, f_names$(), n_count&, bpp&
    CreateStrip strip&, f_names$(), n_count&, bpp&
ElseIf InStr(LCase$(opt$), "-st") Then
    Print "-st"
    CreateStrip strip&, f_names$(), n_count&, bpp&
Else
    CreateSheet sheet&, f_names$(), n_count&, bpp&
End If
Reply
#2
Try add > 0
 if instr.... > 0 and instr... > 0 then...


Reply
#3
_AndAlso for logic decisions and not binary comparisons.

If instr... _AndAlso instr.... then
Reply
#4
Thank you both.  I knew the answer was probably simple.
Reply




Users browsing this thread: 1 Guest(s)