Hi every Experts!
I am looking some VBA script for my search results.
I am searching a value ;
.findById("wnd[0]").maximize
.findById("wnd[0]").sendVKey 71
.findById("wnd[1]/usr/txtRSYSF-STRING").Text = "6306"
.findById("wnd[1]/usr/txtRSYSF-STRING").caretPosition = 6
.findById("wnd[1]").sendVKey 0
If the search results that I found then this code will copy and paste into my excel ;
.findById("wnd[2]/usr/lbl[5,2]").SetFocus
.findById("wnd[2]/usr/lbl[5,2]").caretPosition = 2
.findById("wnd[2]/usr/lbl[48,2]").SetFocus
.findById("wnd[2]/usr/lbl[48,2]").caretPosition = 6
Sheet2.Cells(22, 4) = .findById("wnd[2]/usr/lbl[5,2]").Text
Sheet2.Cells(22, 5) = .findById("wnd[2]/usr/lbl[48,2]").Text
.findById("wnd[1]").sendVKey 0
.findById("wnd[2]/tbar[0]/btn[17]").press
.findById("wnd[1]/tbar[0]/btn[12]").press
But If I don’t have any search results then it’s says "Search unsuccessful - no hits found for: 6306" ;
.findById("wnd[2]/usr/txtMESSTXT1").caretPosition = 4
.findById("wnd[2]/tbar[0]/btn[0]").press
.findById("wnd[1]/tbar[0]/btn[12]").press
Is there any way I can do If and else function? Or I can do another statement? (IF or Else) or argument ? something like that , I want combine this all together.
Thanks all,