ub login() If Date > #2/28/2011# Then MsgBox "O prazo de validade deste aplicativo expirou, pegue uma nova versão em www.sr2604.mg.caixa", vbCritical, "Proteção..." End End If If Plan1.OptionButton4 = True Then If Plan1.TextBox1.TextLength < Plan1.TextBox1.MaxLength Or Plan1.TextBox2.TextLength < Plan1.TextBox2.MaxLength Then MsgBox "Preencha TODOS os campos do contrato!", vbCritical End End If If Plan1.OptionButton1 = True Then Load Form_Login Form_Login.Show End If Macro End If If Plan1.OptionButton5 = True Then If Plan1.TextBox4.TextLength < Plan1.TextBox4.MaxLength Or Plan1.TextBox5.TextLength < Plan1.TextBox5.MaxLength Then MsgBox "Preencha TODOS os campos do CPF!", vbCritical End End If Load Form_Login Form_Login.Show Macro2 End If End Sub Sub Macro() '-------------------------------------------------------------------------------------------- Dim Sess0 As ExtraSession Dim System As ExtraSystem Dim tela As ExtraScreen Set System = CreateObject("EXTRA.System") Set Sess0 = System.ActiveSession If (Sess0 Is Nothing) Then MsgBox "Programa Rede Caixa não está aberto!", vbCritical Exit Sub End If Set tela = Sess0.Screen System.TimeoutValue = 5000 tempo = 5000 '-------------------------------------------------------------------------------------------- If Plan1.OptionButton1 = True Then '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(17, 17, 10)) <> "SELECIONE" And _ Trim(tela.GetString(17, 16, 10)) <> "SELECIONE" Then MsgBox "Você não está na Tela Incial do Rede Caixa!", vbCritical, "Erro Fatal!" tela.SendKeys ("") End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("") tela.SendKeys ("520") '-------------------------------------------------------------------------------------------- cont = 0 Do While tela.GetString(16, 10, 5) <> "SIGLA" And cont < tempo: cont = cont + 1 Loop If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys (Form_Login.login.Value) tela.SendKeys (Form_Login.senha.Value) tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("6020") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(5, 5, 6)) = "SENHOR" Then tela.SendKeys ("") End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(24, 1, 4)) = "BASE" Then MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(24, 1, 4)) = "BASE" Then MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("01") '-------------------------------------------------------------------------------------------- End If '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Plan1.OptionButton3.Value = True Then If Trim(tela.GetString(5, 2, 7)) <> "CLIENTE" Then MsgBox "Você não está na tela de dívida da Rede Caixa!", vbCritical End End If tela.SendKeys (" ") End If '-------------------------------------------------------------------------------------------- If Plan1.OptionButton2.Value = False Then '-------------------------------------------------------------------------------------------- tela.SendKeys ("") tela.SendKeys (Plan1.TextBox1.Text) tela.SendKeys (Plan1.TextBox2.Text) tela.SendKeys (Plan1.TextBox3.Text) tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- End If '-------------------------------------------------------------------------------------------- Limpar '-------------------------------------------------------------------------------------------- 'PEGA OS DADOS NA TELA '-------------------------------------------------------------------------------------------- SUREG = Trim(tela.GetString(4, 10, 2)) AGENCIA = Trim(tela.GetString(4, 17, 4)) OPER = Trim(tela.GetString(4, 29, 3)) NUMCONTR = Trim(tela.GetString(4, 44, 7)) DVCONTR = tela.GetString(4, 52, 2) CLIENTE = Trim(tela.GetString(5, 15, 35)) DIA = Trim(tela.GetString(4, 67, 2)) MES = Trim(tela.GetString(4, 72, 2)) ANO = Trim(tela.GetString(4, 77, 4)) VALOR = Trim(tela.GetString(10, 34, 46)) '-------------------------------------------------------------------------------------------- If VALOR = "--------" Then VALOR = Trim(tela.GetString(9, 34, 46)) MsgBox "O Contrato está em CA!", vbCritical End If '-------------------------------------------------------------------------------------------- 'JOGA OS DADOS NO FORMULÁRIO '-------------------------------------------------------------------------------------------- Plan1.Range("AA6") = SUREG Plan1.Range("AF6") = AGENCIA Plan1.Range("AK6") = OPER Plan1.Range("AP6") = NUMCONTR Plan1.Range("AY6") = DVCONTR Plan1.Label8.Caption = CLIENTE Plan1.Range("D6") = CLIENTE Plan1.Range("AI10") = DIA Plan1.Range("AK10") = "/ " + MES Plan1.Range("AN10") = "/ " + ANO Plan1.Range("A62") = "R$ " + VALOR Plan1.Range("I26") = "0" Plan2.Range("B25") = "Liquidação do contrato " + AGENCIA + "." + OPER + "." + NUMCONTR + "-" + DVCONTR + " de " Plan2.Range("B27") = CLIENTE + " em operação de renovação." End Sub Sub Macro2() '-------------------------------------------------------------------------------------------- Dim Sess0 As ExtraSession Dim System As ExtraSystem Dim tela As ExtraScreen Set System = CreateObject("EXTRA.System") Set Sess0 = System.ActiveSession If (Sess0 Is Nothing) Then MsgBox "Programa Rede Caixa não está aberto!", vbCritical Exit Sub End If Set tela = Sess0.Screen System.TimeoutValue = 5000 tempo = 5000 '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(17, 17, 10)) <> "SELECIONE" And _ Trim(tela.GetString(17, 16, 10)) <> "SELECIONE" Then MsgBox "Você não está na Tela Incial do Rede Caixa!", vbCritical, "Erro Fatal!" tela.SendKeys ("") End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("") tela.SendKeys ("520") '-------------------------------------------------------------------------------------------- cont = 0 Do While tela.GetString(16, 10, 5) <> "SIGLA" And cont < tempo: cont = cont + 1 Loop If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys (Form_Login.login.Value) tela.SendKeys (Form_Login.senha.Value) tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("0520") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(5, 5, 6)) = "SENHOR" Then tela.SendKeys ("") End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(24, 1, 4)) = "BASE" Then MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(24, 1, 4)) = "BASE" Then MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("1") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys (Plan1.TextBox4.Text) tela.SendKeys ("") tela.SendKeys (Plan1.TextBox5.Text) tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- Limpar '-------------------------------------------------------------------------------------------- Plan1.Label8.Caption = Trim(tela.GetString(5, 31, 50)) 'Nome do Cliente '-------------------------------------------------------------------------------------------- PAGINA = 0 cont2 = 0 While Trim(tela.GetString(20, 77, 4)) <> PAGINA And cont < tempo: '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(10, 24, 4)) = "" Then MsgBox "O CLIENTE NÃO POSSUI CONTRATOS!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(11, 2, 19)) = "NORMAL" Or Trim(tela.GetString(11, 2, 19)) = "CREDITO EM ATRASO" Then Plan1.ComboBox1.AddItem (Trim(tela.GetString(10, 24, 4)) + Trim(tela.GetString(10, 29, 3)) + Trim(tela.GetString(10, 33, 7))) End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(14, 2, 19)) = "NORMAL" Or Trim(tela.GetString(14, 2, 19)) = "CREDITO EM ATRASO" Then Plan1.ComboBox1.AddItem (Trim(tela.GetString(13, 24, 4)) + Trim(tela.GetString(13, 29, 3)) + Trim(tela.GetString(13, 33, 7))) End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(17, 2, 19)) = "NORMAL" Or Trim(tela.GetString(17, 2, 19)) = "CREDITO EM ATRASO" Then Plan1.ComboBox1.AddItem (Trim(tela.GetString(16, 24, 4)) + Trim(tela.GetString(16, 29, 3)) + Trim(tela.GetString(16, 33, 7))) End If '-------------------------------------------------------------------------------------------- PAGINA = Trim(tela.GetString(20, 77, 4)) '-------------------------------------------------------------------------------------------- tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont2 = cont2 + 1 '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If Wend '-------------------------------------------------------------------------------------------- If cont2 = tempo Then MsgBox "Ocorreu um erro no processamento das informações , repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("6020") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(5, 5, 6)) = "SENHOR" Then tela.SendKeys ("") End If '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- If Trim(tela.GetString(24, 1, 4)) = "BASE" Then MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- tela.SendKeys ("01") '-------------------------------------------------------------------------------------------- cont = 0 While tela.OIA.XStatus <> 0 And cont < tempo: cont = cont + 1 Wend If cont = tempo Then MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!" End End If '-------------------------------------------------------------------------------------------- End Sub Sub Limpar() Plan1.Range("AA6") = " " Plan1.Range("AF6") = " " Plan1.Range("AK6") = " " Plan1.Range("AP6") = " " Plan1.Range("AY6") = " " Plan1.Range("D6") = " " Plan1.Range("AI10") = " " Plan1.Range("AK10") = " " Plan1.Range("AN10") = " " Plan1.Range("A62") = "0,00" Plan1.Range("I26") = "0,00" Plan1.Range("D16") = " " Plan1.Range("L16") = " " Plan1.Range("P16") = "0,00" Plan1.Range("AA16") = " " Plan1.Range("AF16") = "0,00" Plan1.Range("AO16") = " " Plan1.Range("AT16") = "0,00" Plan1.Range("D21") = " " Plan1.Range("P21") = "0,00" Plan1.Range("AA21") = " " Plan1.Range("AF21") = "0,00" Plan1.Range("AO21") = " " Plan1.Range("AT21") = "0,00" Plan1.Range("AF26") = " " Plan1.Range("AO26") = " " Plan1.Range("AT26") = "0,00" Plan2.Range("B25") = " " Plan1.Label8.Caption = "" 'Cliente '-------------------------------------------------------------------------------------------- If Plan1.OptionButton4 = True Then Plan1.TextBox1.Text = "" 'AG Plan1.TextBox2.Text = "" 'OP Plan1.TextBox3.Text = "" 'Nº Conta End If '-------------------------------------------------------------------------------------------- If Plan1.OptionButton5 = True Then Plan1.TextBox4.Text = "" 'CPF Plan1.TextBox5.Text = "" 'CPF DV Plan1.ComboBox1.Clear 'Contratos End If '-------------------------------------------------------------------------------------------- End Sub