Usuário com melhor resposta
Erro em tempo de execução '-2147417848 (80010108)' - Erro de Automação - O objeto chamado foi desconectado de seus clientes.

Pergunta
-
Gente, bom dia!
Trabalho com a Area de Planejamento Estratégico e Financeiro de um Call Center.
Fiz esta macro a um tempo já, e mantenho a manutenção dela constantemente, contudo não estou conseguindo compreender este erro apresentado em uma planilha em específico, a mesma macro em outras planilhas funciona normalmente.
A macro completa funciona da seguinte forma.
CMS Supervisor aberto
Extrai relatórios do CMS
Salva-os em .txt na pasta da planilha
Limpa as sheet's onde serão colados
Cola os valores
Apaga os .txt
Contudo nesta planilha apenas, ao executar, ela segue todos os processos até colar valores, na hora de abrir os .txt é apresentado o caminho, o vba encontra o caminho e o arquivo, contudo não consegue abri-los
Já re-escrevi o código todo do 0, copiei de outra planilha que está funcionando e não sei onde posso corrigir a situação.
O erro é apresentado na primeira secção de abertura do arquivo
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & ActiveWorkbook.Path & "\Login_Logout.txt", _
Destination:=ActiveCell) (aqui em específico)Segue o código
Sub Alocando_Dados()
Sheets("Login-Logout").Select
Cells.ClearContents
Cells(1, 1).Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & ActiveWorkbook.Path & "\Login_Logout.txt", _
Destination:=ActiveCell)
.Name = "Login_Logout"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
Deslocamento = Application.CountA(Range(Cells(1, 1), Cells(20000, 1)))
Cells(Deslocamento + 1, 1).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & ActiveWorkbook.Path & "\Login_Logout2.txt", _
Destination:=ActiveCell)
.Name = "Login_Logout2"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
Deslocamento = Application.CountA(Range(Cells(1, 1), Cells(20000, 1)))
Cells(Deslocamento + 1, 1).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & ActiveWorkbook.Path & "\Login_Logout3.txt", _
Destination:=ActiveCell)
.Name = "Login_Logout3"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
Deslocamento = Application.CountA(Range(Cells(1, 1), Cells(20000, 1)))
Cells(Deslocamento + 1, 1).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & ActiveWorkbook.Path & "\Login_Logout4.txt", _
Destination:=ActiveCell)
.Name = "Login_Logout4"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
Sheets("Staffed").Select
Cells.ClearContents
Cells(1, 1).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & ActiveWorkbook.Path & "\Produtividade.txt", _
Destination:=ActiveCell)
.Name = "\Produtividade"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
Kill ActiveWorkbook.Path & "\Login_Logout.txt"
Kill ActiveWorkbook.Path & "\Login_Logout2.txt"
Kill ActiveWorkbook.Path & "\Login_Logout3.txt"
Kill ActiveWorkbook.Path & "\Login_Logout4.txt"
Kill ActiveWorkbook.Path & "\Produtividade.txt"
End With
Sheets("Agents").Select
End Sub
Respostas
-
André Santos.
Obrigado pela preocupação, mas já consegui resolver a dificuldade apresentada rsrs
Tenho todas as planilhas dentro do sistema de rede local na empresa, e como todas as maquinas do Time estão munidas de todo tipo de suplemento e complemento para o VBA, sempre temos nossas macros funcionais.
Fui verificar na maquina que utilizou a planilha pela ultima vez e esta não fazia parte do time de Planejamento, desabilitando boa parte dos suplementos de CMS e complementos como Solver e VBAProjects.
Quando concluir toda a instalação de nossos complementos e suplementos no VBA da maquina, as funções voltaram a funcionar sem erros, e o tempo de resposta das conexões também estabilizou.Agora está funcionando perfeitamente.
- Sugerido como Resposta André Santo quarta-feira, 16 de março de 2016 15:49
- Marcado como Resposta Felipe Costa GualbertoMVP, Moderator quarta-feira, 16 de março de 2016 19:15
Todas as Respostas
-
Bom dia Mini Algoz,
Faça este procedimento de se conectar ao arquivo e colar na célula desejada, mas com o gravador de macros habilitado.
Ele irá gerar um código por trás, cole o que foi gerado aqui para que possamos avaliar as diferenças e possivelmente identificar o erro.
André Santo | basevba.wordpress.com
-
André Santos.
Obrigado pela preocupação, mas já consegui resolver a dificuldade apresentada rsrs
Tenho todas as planilhas dentro do sistema de rede local na empresa, e como todas as maquinas do Time estão munidas de todo tipo de suplemento e complemento para o VBA, sempre temos nossas macros funcionais.
Fui verificar na maquina que utilizou a planilha pela ultima vez e esta não fazia parte do time de Planejamento, desabilitando boa parte dos suplementos de CMS e complementos como Solver e VBAProjects.
Quando concluir toda a instalação de nossos complementos e suplementos no VBA da maquina, as funções voltaram a funcionar sem erros, e o tempo de resposta das conexões também estabilizou.Agora está funcionando perfeitamente.
- Sugerido como Resposta André Santo quarta-feira, 16 de março de 2016 15:49
- Marcado como Resposta Felipe Costa GualbertoMVP, Moderator quarta-feira, 16 de março de 2016 19:15
-