OI gente abaixo apresento a macro. Alguém pode me dar pelo menos um caminho para que eu mesma faça isso?
Código: Selecionar todosPrivate Sub cmdImportar_Click()
Dim objFSO As Object, objTextFile As Object
Dim iFF As Integer
Dim sLinha As String
Dim QtyLinhas As Long, i As Long
If Dir(txtCaminho) = vbNullString Then MsgBox "Arquivo não encontrado", vbExclamation: Exit Sub
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(txtCaminho.Value)
'Lê todo o arquivo
objTextFile.ReadAll
QtyLinhas = objTextFile.Line
'configura a ProgressBar
pb.Max = QtyLinhas
pb.Value = 0
iFF = FreeFile
Open txtCaminho For Input As iFF
'Limpa os dados da planilha que irá receber
shtDados.Cells.Clear
'Faz leitura do arquivo linha a linha
Do While Not EOF(iFF)
i = i + 1
Line Input #iFF, sLinha
arrData = Split(sLinha, "|")
shtDados.Cells(i, 1) = UBound(arrData) - 1
For j = 2 To UBound(arrData)
shtDados.Cells(i, j).NumberFormat = "@"
shtDados.Cells(i, j) = arrData(j - 1)
Next j
pb.Value = i
Loop
shtDados.Columns.AutoFit
shtDados.Columns(1).Hidden = True
Unload Me
MsgBox "Arquivo importado com sucesso", vbInformation
Close iFF
End Sub
Private Sub cmdSelecionar_Click()
Dim sArquivo As Variant
Dim sTipo As String, sTitulo As String
sTipo = "Arquivo SPED (*.txt),*.txt"
sTitulo = "Selecione um arquivo"
sArquivo = SelecionarArquivo(sTipo, sTitulo, False)
If TypeName(sArquivo) = "String" Then
txtCaminho = sArquivo
End If
End Sub