Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
#28866
Galera, recentemente surgiu uma ideia de importar um arquivo TXT de uma pasta qualquer do meu computador para a planilha do Excel, até ai tudo bem...
porém este arquivo TXT é um arquivo que fica atualizando constantemente, sendo assim gostaria que essas informações fossem transferidas para a planilha, mantendo as atualizações do arquivo. Sendo assim gostaria de saber como importar o arquivo TXT de forma automática, ficando na mesma tabela da planilha Excel os dados mais recentes do arquivo TXT? O Objetivo final é eu adicionar uma Macro para que me envia por e-mail as ultimas atualizações feita na planilha.
Ficaria bem agradecido se alguém conseguir me ajudar!
Imagem
Imagem
Imagem
Código: Selecionar todos
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$F$3"
    Call AutoSend
     End Select
End Sub

Sub AutoSend()
'
' AutoSend Macro
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olMailItem)
    
With myItem
    .To = Range("G5")
    .CC = Range("G6")
    .Subject = Range("G7")
    .Body = Range("F3")
    .send
End With
End Sub
Código: Selecionar todos
Sub ImportarFile()
'
' Macro2 Macro
'

'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\Users\RPSZ\Desktop\elfscript.log", Destination:=Range("$B$2"))
        .Name = "elfscript"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 1252
        .TextFileStartRow = 1
        .TextFileParseType = xlFixedWidth
        .TextFileTextQualifier = xlTextQualifierNone
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(3, 1, 9)
        .TextFileFixedColumnWidths = Array(12, 66)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
    ActiveWindow.SmallScroll Down:=-9
    Range("B2").Select
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord