Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search word in thrid occurance 1

Status
Not open for further replies.

limeg95

Programmer
Oct 22, 2009
124
CA
Skip
I am searching a word 'Total"in report
there are three totals i want only third total with corresponding value this search first total
here is the code
For j = 5 To 41
dfst = Cells(j, 1).Text

if dfst = MyScreen.GetString(1,15,5) then
If dfst <> "" then
do
Set MyArea = MyScreen.Search("Total")
MyScreen.MoveTo MyArea.Bottom, MyArea.Right + 2
MyScreen.Moveto 2, 15
MyRw = MyScreen.Row
Sess0.Screen.Sendkeys("<PF8>")
loop
Next
 
skip
this is my code
search find one page or multiple page
-------------------------------
For j = 7 To 48
DSFPT = Cells(j, 1).Text
DSFPT1 = Trim(MyScreen.GetString(6, 9, 6))

If DSFPT <> "" Then

If DSFPT = DSFPT1 Then

Set MYArea = MyScreen.Search("OUTPUT MASTER FILE")
MyScreen.Moveto MYArea.Bottom, MYArea.Left
MyRw = MyScreen.Row
If MyRw Then
Set MyArea1 = MyScreen.Search("TOTALS")

MyScreen.Moveto MyArea1.Bottom, MyArea1.Left
MyRw = MyScreen.Row


MyScreen.SendKeys ("<PF8>")
End If
If MyRw <> 1 Then

' MsgBox (MyRw)

Mytotal1 = Trim(MyScreen.GetString(MyRw, 45, 5))
Mytotal2 = Trim(MyScreen.GetString(MyRw, 64, 12))

MyScreen.SendKeys ("<PF8>")

End If
End If
End If
Cells(j, (Mycol + 1)).Value = Mytotal1

Cells(j, (Mycol + 2)).Value = Mytotal2
Next j

MyScreen.SendKeys ("<PF3>")

End Sub
 
yes the title is not in first page it is in second page . my question is search command is searching first page only or all pages.
 


You search and page until it is found.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
skip
could you please provide example ("search and page until it is found")
thanks
 



Code:
    Set MYArea = MyScreen.Search("OUTPUT MASTER FILE")
    If MYArea Is Nothing then
       'next page
    Else
       'now search for 'TOTAL'
    End if

Skip,
[sub]
[glasses]Just traded in my old subtlety...
[b]for a NUANCE![/b][tongue][/sub]
 
thanks a lot Skip
Great help
It works great but only one small issue
cells(j, i).text has space issue for exampe "xxx "
after x space showing so do i have to mention space
DSFPT1 = Trim(MyScreen.GetString(6, 9, 6))

If DSFPT <> "" Then

If Cells(j, 1).Text = DSFPT1 Then
 



...and the question is.....??????

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip
thanks for your valuable time.
if cells(j,1).text = "xxx "
and screen DSFPT1 = "XXX"
both of them not equal technically. because the space issue
if it comes it goes out of the loop .
 


Well you have the SPACE issue and perhapse you have an issue with upper and lower case.

So what you do in addition to using TRIM is to chage both sides of the equation to either upper of lower case.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



...excuse me...

upper OR lower case.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top