Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Amigos,
Estou com um problema que não encontro a solução em nenhum lugar do planeta. :upset:
Gostaria de criar uma conexão com o txt, mas sem salvar a definição da consulta, pois depois de vários loops o Excel acaba sobrecarregado de tantas conexões e fica lento.
Parte do código que estou utilizando:
Sub ImportaTxt()
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Relatorio.txt", _
Destination:=Range("$A$1"))
.Name = "Teste"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 932
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(24, 2, 4)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Queria saber qual a propriedade no VBA referente a opção no Excel 2007: DADOS > CONEXÕES > PROPRIEDADES. Ítem "Salvar definição de consulta"
Obrigado!
Carregando comentários...