Ir para conteúdo
Fórum Script Brasil
  • 0

Erro tempo de execução 70 "Permissão Negada"


Carlos Eduardo Quinalia

Pergunta

Boa tarde,

Preciso de uma ajuda, o sistema estava funcionando normalmente, tem uma rotina que a pessoa salva os dados e ele após salvar gera um email automatico, ou seja, abre o outlook  já com os destinatários e envia, agora não está fazendo mais, após salvar apararece "erro tempo de execução 70 "Permissão Negada" e depois não gera o email e abre o formulário no excel que seria o que deveria estar no email.

O que pode ser ?

segue código que está acontecendo

'Registrar Status do Contrato como "Aprovado" se todos os documentos forem recebidos
                    sql = " UPDATE 02_Contratos SET Status_Contrato = 'APROVADO', Data_Status_Contrato = #" & data & "#, Resp_Status_Contrato = '" & Range("w2").Value & "' WHERE Designação_da_Frota= '" & Cells(12 + i, 3).Value & "' and Número_do_Contrato = '" & Cells(12 + i, 4).Value & "' and SdA = '" & Cells(12 + i, 6).Value & "' and (AS_Emitido='Aprovado' and AS_Aprovado_Vendas='Aprovado' and AS_Aprovado_Controlling='Aprovado' and Cond_Comerciais='Aprovado' and Sda_Aprovada='Aprovado' and Contrato_Rubricado_Recebido='Aprovado' and Compr_Residencia='Aprovado' and Doc_Pessoal='Aprovado' and Mail_com_Contrato_OK='Aprovado' and Termo_de_Autorização='Aprovado' and Solic_Criação_Conta='Aprovado' and Nr_Solic_Criação_Conta is not null and Contas_Criadas='Aprovado' and Conta_Mainframe is not null and Conta_SAP is not null and Status_Contrato is null or Status_Contrato not like '%provado')"
                    cx.Conectar
                    banco.Open sql, cx.Conn
                    cx.Desconectar
        
                'Registrar Status do Contrato como "Incompleto" algum documento estiver em branco
                    sql = " UPDATE 02_Contratos SET Status_Contrato = 'INCOMPLETO', Data_Status_Contrato = #" & data & "#, Resp_Status_Contrato = '" & Range("w2").Value & "' WHERE Designação_da_Frota= '" & Cells(12 + i, 3).Value & "' and Número_do_Contrato = '" & Cells(12 + i, 4).Value & "' and SdA = '" & Cells(12 + i, 6).Value & "' and (AS_Emitido is null or AS_Aprovado_Vendas is null or AS_Aprovado_Controlling is null or Cond_Comerciais is null or Sda_Aprovada is null or Contrato_Rubricado_Recebido is null or Compr_Residencia is null or Doc_Pessoal is null or Mail_com_Contrato_OK is null or Termo_de_Autorização is null or Solic_Criação_Conta is null or Nr_Solic_Criação_Conta is null or Contas_Criadas is null or Conta_Mainframe is null or Conta_SAP is null)"
                    cx.Conectar
                    banco.Open sql, cx.Conn
                    cx.Desconectar
                    
                'Registrar Status do Contrato como "Reprovado" se um dos documentos for reprovado
                    sql = " UPDATE 02_Contratos SET Status_Contrato = 'REPROVADO', Data_Status_Contrato = #" & data & "#, Resp_Status_Contrato = '" & Range("w2").Value & "' WHERE Designação_da_Frota= '" & Cells(12 + i, 3).Value & "' and Número_do_Contrato = '" & Cells(12 + i, 4).Value & "' and SdA = '" & Cells(12 + i, 6).Value & "' and (AS_Emitido='Reprovado' or AS_Aprovado_Vendas='Reprovado' or AS_Aprovado_Controlling='Reprovado' or Cond_Comerciais='Reprovado' or Sda_Aprovada='Reprovado' or Contrato_Rubricado_Recebido='Reprovado' or Compr_Residencia='Reprovado' or Doc_Pessoal='Reprovado' or Mail_com_Contrato_OK='Reprovado' or Termo_de_Autorização='Reprovado' or Solic_Criação_Conta='Reprovado' or Contas_Criadas='Reprovado')"
                    cx.Conectar
                    banco.Open sql, cx.Conn
                    cx.Desconectar

                
                'montar email para consultor
              If campos > 0 And Cells(12 + i, 12).Value = "REPR" Or Cells(12 + i, 13).Value = "APR" Or Cells(12 + i, 14).Value = "APR" Or Cells(12 + i, 15).Value = "APR" Or Cells(12 + i, 16).Value = "APR" Or Cells(12 + i, 17).Value = "APR" Or Cells(12 + i, 18).Value = "APR" Or Cells(12 + i, 19).Value = "APR" Or Cells(12 + i, 20).Value = "APR" Or Cells(12 + i, 12).Value = "REPR" Or Cells(12 + i, 13).Value = "REPR" Or Cells(12 + i, 14).Value = "REPR" Or Cells(12 + i, 15).Value = "REPR" Or Cells(12 + i, 16).Value = "REPR" Or Cells(12 + i, 17).Value = "REPR" Or Cells(12 + i, 18).Value = "REPR" Or Cells(12 + i, 19).Value = "REPR" Or Cells(12 + i, 20).Value = "REPR" Then
                'Sheets("Tabelas").Range("ER16").Value = Sheets("Documentação").Cells(12 + i, 9).Value
                Sheets("Tabelas").Range("ES16").Value = Sheets("Documentação").Cells(12 + i, 10).Value
                Sheets("Tabelas").Range("ET16").Value = Sheets("Documentação").Cells(12 + i, 11).Value
                Sheets("Tabelas").Range("EU16").Value = Sheets("Documentação").Cells(12 + i, 12).Value
                Sheets("Tabelas").Range("EV16").Value = Sheets("Documentação").Cells(12 + i, 13).Value
                Sheets("Tabelas").Range("EW16").Value = Sheets("Documentação").Cells(12 + i, 14).Value
                Sheets("Tabelas").Range("EX16").Value = Sheets("Documentação").Cells(12 + i, 15).Value
                Sheets("Tabelas").Range("EY16").Value = Sheets("Documentação").Cells(12 + i, 16).Value
                Sheets("Tabelas").Range("EZ16").Value = Sheets("Documentação").Cells(12 + i, 17).Value
                Sheets("Tabelas").Range("FA16").Value = Sheets("Documentação").Cells(12 + i, 18).Value
                Sheets("Tabelas").Range("FB16").Value = Sheets("Documentação").Cells(12 + i, 19).Value
                Sheets("Tabelas").Range("FC16").Value = Sheets("Documentação").Cells(12 + i, 20).Value
                Sheets("Tabelas").Range("FD16").Value = Sheets("Documentação").Cells(12 + i, 25).Value
                Sheets("Tabelas").Range("FE16").Value = Sheets("Documentação").Cells(12 + i, 26).Value
                Sheets("Tabelas").Range("s27").Value = Sheets("Documentação").Cells(12 + i, 6).Value
                Sheets("Tabelas").Range("s29").Value = Sheets("Documentação").Cells(12 + i, 3).Value
                Sheets("Tabelas").Range("u23").Value = Sheets("Documentação").Cells(12 + i, 7).Value
                'Trocar APR e REPR por Aprovado e Reprovado
                
                teste222 = Sheets("Tabelas").Range("ES16").Value
                
                For y = 1 To 10
                    If Sheets("Tabelas").Cells(16, 149 + y).Value = "APR" Or Sheets("Tabelas").Cells(16, 149 + y).Value = "REPR" Then
                        Sheets("Tabelas").Cells(16, 149 + y).Value = Sheets("Tabelas").Cells(16, 149 + y).Value & "OVADO"
                    End If
                Next
               
                ' Criar e-mail informando consultor sobre andamento da documentação
                Sheets("Tabelas").Select
                sPath = "C:\Temp"

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,7k
×
×
  • Criar Novo...