i am writing macro in attachment. grabing all date, rates and put it in text document
it is ok to show all dates and rate. but exclude last busines day. it shows including last business day.
how do i accomplish my task.
this is the main code
Sess0.Screen.Sendkeys("<HOME>")
Sess0.Screen.Sendkeys("GU<Tab>abcd,USD,")
Sess0.Screen.PutString "???",1,20
Sess0.Screen.PutString ConstStr,1,23
Sess0.Screen.PutString InputPriorToDate,1,26
Sess0.Screen.Sendkeys("<Tab>LKMN4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Print #1, InputPriorToDate$
'***********************************************************************
'*Get each currency's date and amount and print to QrtlyRateDate file. *
'***********************************************************************
ConstCurrCode = Sess0.Screen.GetString(4,67,3)
InputPriorToDate = format(CVdate(InputPriorToDate), "mm/dd/yyyy")
intRowNum=9
static strVar1PrevyearCheck
strVar1PrevyearCheck = (VAL(mid(InputPriorToDate,9,2))-1)
strVar1PrevyearCheck = 0 & strVar1PrevyearCheck
Do
For intRowNum = 9 to 22
'msgbox intRowNum
strErrormsg = Sess0.Screen.GetString(24,2,17)
If strErrormsg = "A205W-END OF LIST" Then
Print #1, "99999"
msgbox "Program Execution Completed."
'sess0.screen.WaitHostQuiet(g_HostSettleTime)
EXIT DO
Exit Sub
Else
StrCurrencyCode = Sess0.Screen.GetString(4,67,3)
'MSGBOX "StrCurrencyCode " & StrCurrencyCode & " ConstCurrCode " & ConstCurrCode
If StrCurrencyCode = ConstCurrCode Then
StrConcatenate = "CIBC1,CAD," & StrCurrencyCode & "S,"
strVar1$ = Sess0.Screen.GetString(intRowNum,11,30) '04/28/03 1.75000000 Effective Date & Conversion Rate
strVar1Date$ = DateValue(format(mid(strVar1$,1,8))) '04/28/03
strVar1Year = Mid(strVar1$,7,2) 'Year(strVar1Date$) '02 or 2002
strVarMarchMonth = Val(mid(InputPriorToDate,1,2))
strDecMonth = Val(mid(strVar1$,1,2))
strVar1generalNum = DateValue(format(strVar1Date$, "Short Date")) '4/28/2003
strInputPriorToDategeneralNum = DateValue(format(InputPriorToDate, "Short Date"))
intLengthInputPriorToDategeneralNum =len(strInputPriorToDategeneralNum)
If intLengthInputPriorToDategeneralNum =8 Then
strInputYear = Mid(STRInputPriorToDategeneralNum,7,2) '1/1/2003
ElseIf intLengthInputPriorToDategeneralNum =9 Then
strInputYear = Mid(STRInputPriorToDategeneralNum,8,2) '1/20/2003, 12/1/2003
ElseIf intLengthInputPriorToDategeneralNum =10 Then
strInputYear = Mid(STRInputPriorToDategeneralNum,9,2) '12/12/2003
End If
strDifference=val(strInputYear) - val(strVar1Year)
If strVarMarchMonth= 3 AND strDecMonth= 12 AND _
STRVAR1generalNum < STRInputPriorToDategeneralNum AND _
strVar1Year = strVar1PrevyearCheck Then
Print #1, StrConcatenate & strVar1
Else
If strVar1Date$ >= STRInputPriorToDategeneralNum AND strDifference >1 Then
Else
If STRVAR1generalNum < STRInputPriorToDategeneralNum _
AND strDifference =1 Then
Print #1, StrConcatenate & strVar1
End If
If STRVAR1generalNum < STRInputPriorToDategeneralNum _
AND strDifference =0 Then
Print #1, StrConcatenate & strVar1
End If
End If
End If
Else
Msgbox "New currency(StrCurrencyCode) code on screen is " + StrCurrencyCode + " Constant(old(ConstCurrCode)) is " + ConstCurrCode
ConstCurrCode = StrCurrencyCode
'Msgbox "Currency is new i.e. Constant(after swap(ConstCurrCode)) is " + ConstCurrCode
EXIT DO
End If
End If
Next intRowNum
Sess0.Screen.Sendkeys("<Home>")
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
ConstCurrCode = Sess0.Screen.GetString(4,67,3)
If StrCurrencyCode <> ConstCurrCode Then
Print #1, ""
End If
Loop
it is ok to show all dates and rate. but exclude last busines day. it shows including last business day.
how do i accomplish my task.
this is the main code
Sess0.Screen.Sendkeys("<HOME>")
Sess0.Screen.Sendkeys("GU<Tab>abcd,USD,")
Sess0.Screen.PutString "???",1,20
Sess0.Screen.PutString ConstStr,1,23
Sess0.Screen.PutString InputPriorToDate,1,26
Sess0.Screen.Sendkeys("<Tab>LKMN4<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Print #1, InputPriorToDate$
'***********************************************************************
'*Get each currency's date and amount and print to QrtlyRateDate file. *
'***********************************************************************
ConstCurrCode = Sess0.Screen.GetString(4,67,3)
InputPriorToDate = format(CVdate(InputPriorToDate), "mm/dd/yyyy")
intRowNum=9
static strVar1PrevyearCheck
strVar1PrevyearCheck = (VAL(mid(InputPriorToDate,9,2))-1)
strVar1PrevyearCheck = 0 & strVar1PrevyearCheck
Do
For intRowNum = 9 to 22
'msgbox intRowNum
strErrormsg = Sess0.Screen.GetString(24,2,17)
If strErrormsg = "A205W-END OF LIST" Then
Print #1, "99999"
msgbox "Program Execution Completed."
'sess0.screen.WaitHostQuiet(g_HostSettleTime)
EXIT DO
Exit Sub
Else
StrCurrencyCode = Sess0.Screen.GetString(4,67,3)
'MSGBOX "StrCurrencyCode " & StrCurrencyCode & " ConstCurrCode " & ConstCurrCode
If StrCurrencyCode = ConstCurrCode Then
StrConcatenate = "CIBC1,CAD," & StrCurrencyCode & "S,"
strVar1$ = Sess0.Screen.GetString(intRowNum,11,30) '04/28/03 1.75000000 Effective Date & Conversion Rate
strVar1Date$ = DateValue(format(mid(strVar1$,1,8))) '04/28/03
strVar1Year = Mid(strVar1$,7,2) 'Year(strVar1Date$) '02 or 2002
strVarMarchMonth = Val(mid(InputPriorToDate,1,2))
strDecMonth = Val(mid(strVar1$,1,2))
strVar1generalNum = DateValue(format(strVar1Date$, "Short Date")) '4/28/2003
strInputPriorToDategeneralNum = DateValue(format(InputPriorToDate, "Short Date"))
intLengthInputPriorToDategeneralNum =len(strInputPriorToDategeneralNum)
If intLengthInputPriorToDategeneralNum =8 Then
strInputYear = Mid(STRInputPriorToDategeneralNum,7,2) '1/1/2003
ElseIf intLengthInputPriorToDategeneralNum =9 Then
strInputYear = Mid(STRInputPriorToDategeneralNum,8,2) '1/20/2003, 12/1/2003
ElseIf intLengthInputPriorToDategeneralNum =10 Then
strInputYear = Mid(STRInputPriorToDategeneralNum,9,2) '12/12/2003
End If
strDifference=val(strInputYear) - val(strVar1Year)
If strVarMarchMonth= 3 AND strDecMonth= 12 AND _
STRVAR1generalNum < STRInputPriorToDategeneralNum AND _
strVar1Year = strVar1PrevyearCheck Then
Print #1, StrConcatenate & strVar1
Else
If strVar1Date$ >= STRInputPriorToDategeneralNum AND strDifference >1 Then
Else
If STRVAR1generalNum < STRInputPriorToDategeneralNum _
AND strDifference =1 Then
Print #1, StrConcatenate & strVar1
End If
If STRVAR1generalNum < STRInputPriorToDategeneralNum _
AND strDifference =0 Then
Print #1, StrConcatenate & strVar1
End If
End If
End If
Else
Msgbox "New currency(StrCurrencyCode) code on screen is " + StrCurrencyCode + " Constant(old(ConstCurrCode)) is " + ConstCurrCode
ConstCurrCode = StrCurrencyCode
'Msgbox "Currency is new i.e. Constant(after swap(ConstCurrCode)) is " + ConstCurrCode
EXIT DO
End If
End If
Next intRowNum
Sess0.Screen.Sendkeys("<Home>")
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
ConstCurrCode = Sess0.Screen.GetString(4,67,3)
If StrCurrencyCode <> ConstCurrCode Then
Print #1, ""
End If
Loop