PDA

Click to See Complete Forum and Search --> : Loop problem


rocket0612
Mar 16th, 2006, 03:59 AM
I am writing a macro for excel to interact with Attachmate and have problems ith a lopp I'm try to do. Heres the code:


Date1 = Range("C20"): Date1 = Format(Date1, "ddmmyy")
Date2 = Range("c22"): Date2 = Format(Date2, "ddmmyy")

If Range("C20") <> "" Then Quote1 = True
If Range("C22") <> "" Then Quote2 = True

If Quote1 = True Then Quotetype1 = Date1 Else Quotetype1 = ""
If Quote2 = True Then Quotetype2 = Date2 Else Quotetype2 = ""


QuoteArray = Array(Quotetype1, Quotetype2)
quoteletterArray = Array(Quotetype1, Quotetype2)
npddarray = Array("", "")
QualArray = Array(qual1, qual2)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ScrnChk = MyScreen.GetString(2, 3, 7)
'If ScrnChk <> "BRPEIMA" Then End: MsgBox ("ended at proj")

'two dates, do 1st date and then loop for second adte
For quoteroutine = 0 To 1
If QuoteArray(quoteroutine) = "" Then GoTo Notes

'run for date 1 for the 3 policiy numbers
For polroutine = 0 To 2
PolNo = polarray(polroutine)
If PolNo = "" Then GoTo Quotevaluesflf

Sess0.Screen.Moveto 21, 68
Sess0.Screen.SendKeys ("PIB")
Sess0.Screen.SendKeys ("<Enter>")
Sess0.Screen.WaitHostQuiet (g_hostsettletime)



The scenario is, a user can input up to 3 policy numbers for the system perform valuations. You have the option to have 2 valuation dates (date 1 & date 2). What I am trying to do is get the 3 policies to run a valuation for the first date and then go back and do the same for the second date.

I am getting the error on the second FOR statement advbising the statement is already in use. I am trying to do like a double loop to do this, make sense!!

any help would be appreciated.

DKenny
Mar 16th, 2006, 09:00 AM
You have 2 FOR statements in the code you posted, but no NEXT statements at all. Can you repost and include the entire procedure?