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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

does not write in text documnet 1

Status
Not open for further replies.

braven

Programmer
May 20, 2009
58
CA
could you check is there any modification in the below code
the macro is not writing in text documnet
this is what i have written.
is there any alternate way to do
checking the amount field. if it is more than 10 it is writing the whole particular row.
code is here
if trim(MyScreen.GetString(6,4,11)) = "SKIP REPORT" THEN
Print #1, "NO RECORDS FOUND" +Chr$(13) + Chr$(10)+"";
else
NotLastPage = true
NumberPage = NumberPage +1
NumberPage = 0

Do while (NotLastPage = true)

For i = 12 to 25
Amtcheck = trim(MyScreen.GetString(14,120,13))
if Amtcheck >= 10.00 then

Print #1, MyScreen.Area(6,71,6,83).value

Print #1, MyScreen.Area(i,02,i,132).value ' ( is not writing in text document

end if
Next i

pause 1
MyScreen.Sendkeys("<Pf8>")
MyScreen.WaitHostQuiet(g_HostSettleTime)

if MyScreen.Search("END OF REPORT").Value = "" then 'if we see request complete it'll skip this loop
NotLastPage = false
End if

Loop
if NumberPage <> 1 then

For i = 12 to 25
if Amtcheck >= 10.00 then
Print #1, MyScreen.Area(6,71,6,83).value
Print #1, MyScreen.Area(i,02,i,132).value
End if
Next i
End if

End if


 



Hi,

1. have you opened a file for output? If so please post.

2. have you traced your code to determine that the Print #1 statement is being executed?

3. have you debuged to confirm the value(s) in the Print #1 statement?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
ski]
thank you for yuo valuable time.
yes it opend for the output
2. it is excuting and run successfully
but when it writes it checks the amot . it is > 10 in screen but it is not writing
is that problem i declare as amtcheck as integer.
i did not get anyerror this is part of the code. i have another part it writes everything in there. but when it checks here it is not . coudl yu please help me what is it actually.
if Amtcheck >= 10.00 then

 



Step thru your code and observe the actual values in Amtcheck.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
skip
i have error
Dim Amtcheck as integer
Amtcheck = trim(MyScreen.GetString(14,120,13))
type mismatch.
in screen 15395.16

 
skip
could you help me
amtcheck shows 0 only but it has data morethan 10.
i put as dim amtcheck
 



Why do you have your variable declaired as an integer, when the value you are scraping is decimal (single or double)?
Code:
Dim Amtcheck as single
 Amtcheck = CSng(trim(MyScreen.GetString(14,120,13)))


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skip
thank you so much. you are helping lot of people like me.
i have another question
if i search amtcheck and corresponding whole line that is row and column
how do i perform do i have to for next or without for do i have any solution regarding this.
 



I cannot understand your question.

Why would you, 'search amtcheck'?

This is contradictory...

'corresponding whole line that is row and column'

Please restate your question clearly, concisely and completely.



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skip
i am looking for amtchek in first page, if it is > 10.00 the corresponding row and column write into text.
and go to next page search and wrtie into text same on......
but if i go for i = 12 to 27
25th line has <<<<<<<<<<<<<<<<<<<<<< it is not end of reprot but is goes next page too.
please help me how to perform this one
i searched the word and the word value and corresponding row and colum into text.
is that right way to do that. but i failed in this code.
 



Usually on screen pages, there is a message area, often on the bottom row. The value in this message is used to determine when to issue a next page command or supply a new search value in the key search field(s), or maybe even some other consition. You must have logic to handle each message correctly.

So you CONTROL LOGIC is very important, and must be in-place and tested correct, BEFORE you even begin writing code to process the data on a screen.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
skip
thanks for your valuable comment.
in this case, can i use search amtcheck if it found the value can put it in text document
unless i find <<<<<<< this one go to next page
is this right way to do that
 


Please post your control structure.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
sKIP
this is what i did so far
if trim(MyScreen.GetString(6,4,11)) = "SKIP REPORT" THEN
Print #1, "NO RECORDS FOUND" +Chr$(13) + Chr$(10)+"";
else

NotLastPage = true
NumberPage = 0
NumberPage = NumberPage +1


Do while (NotLastPage = true)

For i = 12 to 27
Amtcheck = cSng(trim(MyScreen.GetString(i,120,13)))

msgbox(Amtcheck)
if Amtcheck >= 10.00 then
msgbox(Amtcheck)


Print #1, MyScreen.Area(i,02,i,132).value
end if
If MyScreen.Search = "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" then NotlASTPAGE = TRUE


Next i

pause 1
MyScreen.Sendkeys("<Pf8>")
MyScreen.WaitHostQuiet(g_HostSettleTime)

if MyScreen.Search("END OF REPORT").Value = "" then 'if we see request complete it'll skip this loop
NotLastPage = false
End if


'if NumberPage <> 1 then

For i = 12 to 25
Amtcheck = CSng(trim(MyScreen.GetString(14,120,13)))
Msgbox(Amtcheck)
if Amtcheck) >= 10.00 then
msgbox(Amtcheck)
Print #1, MyScreen.Area(i,02,i,132).value
End if
Next i
'End if
Loop
End if


 



Why do you have TWO Print #1 loops within the main Do Loop?

One loops 12 to 27 and the other 12 to 25.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
next page also it checks 12 to 27
sorry by mistake it is 25.
 


You should have ONLY ONE 12 to 25 loop inside your main do loop.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 

Seem to me that something like this would work...
Code:
Do While (NotLastPage)

    If Not MyScreen.Search("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") Is Nothing Then _
        NotLastPage = True
    If Not MyScreen.Search("END OF REPORT") Is Nothing Then _
        NotLastPage = False
    
    For i = 12 To 27
        Amtcheck = CSng(Trim(MyScreen.GetString(i, 120, 13)))
    
        MsgBox (Amtcheck)
        If Amtcheck >= 10# Then
           MsgBox (Amtcheck)
         
         
          Print #1, MyScreen.Area(i, 2, i, 132).Value
         End If

    Next i

    pause 1

    MyScreen.SendKeys ("<Pf8>")
    
    MyScreen.WaitHostQuiet (g_HostSettleTime)
 
Loop


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skip
thank you very much again your valuable time
but it gives error type mismatch
Amtcheck = CSng(Trim(MyScreen.GetString(i, 120, 13)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top