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.
  • Avatar do usuário
Por learfelix
#49745
Bom dia.
Como posso fazer para importar um arquivo do sped contribuições para TXT e depois volta para o formato original ?
Avatar do usuário
Por Jimmy
Avatar
#49746
Olá Felix,

Tem esses dois tópicos que falam do assunto.
Veja se aproveita algo.

http://gurudoexcel.com/forum/viewtopic. ... hilit=sped

http://gurudoexcel.com/forum/viewtopic. ... hilit=sped

Se quiser algo mais específico para a sua necessidade, será necessário dar mais detalhes, anexar planiha, anexar arquivo SPED, etc.

Se esta mensagem colabora para a solução do problema, peço que dê um Like, clicando no botão com o "positivo", acima e a direita.

Jimmy San Juan
Por Fernando10
#54207
Bom dia,

Prezado Jimmy, baixei todos os arquivos dos fórum citado por você acima. Porém não encontrei nenhum que importasse a arquivo txt. da EFD-Contribuições em que separasse os arquivos por planilha.

Se alguém já tiver desenvolvido alguma planilha assim, poderia disponibilizar?
Por Antonio123
#57754
Boa noite galera, tudo bem...
Gostei muito das planilhas, me ajudou bastante, mas se tenho que colocar outras informaçoes nos registros, qdo exporto pro txt a informação vai vazia no txt - o que seria.............
Como solucionar...........
Por pabloviana
#69196
Olá! gostaria de saber como fazer para restringir a importação de apenas dois registros do sped ?

O código vba que estou utilizando importa todos os registros.

Dim vrTemp() As String
Function ExisteSheet(nome As String) As Boolean
Dim Sh As Worksheet
On Error Resume Next
Set Sh = Worksheets(nome)
If Sh Is Nothing Then ExisteSheet = False Else ExisteSheet = True
Set Sh = Nothing
End Function

Sub importarTxt()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False
Application.DisplayStatusBar = False

Dim Tempo As Double
Tempo = Now()

Dim strArquivo As Office.FileDialog
Dim strLinhaTexto As String
Dim intContItens As Integer, x As Integer

Set strArquivo = Application.FileDialog(msoFileDialogOpen)

With strArquivo
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "Arquivos TXT", "*.txt"
.Title = "Selecione um ou mais arquivos"
.Show
End With
intContItens = strArquivo.SelectedItems.Count
If intContItens = 0 Then
MsgBox "Nenhum arquivo selecionado"
Exit Sub
End If
'abre o arquivo texto para leitura.
'Altere para o caminho e nome de seu arquivo
For x = 1 To intContItens
Open strArquivo.SelectedItems(x) For Input As #1

Do While Not EOF(1)
Line Input #1, strLinhaTexto
vrTemp = Split(strLinhaTexto, "|")
If ExisteSheet(vrTemp(1)) = True Then
incluinaplan (vrTemp(1))
Else
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = vrTemp(1)
incluinaplan (vrTemp(1))
End If
Loop
Close #1 'fecha o arquivo texto
Next
Sheets(1).Select

MsgBox "Concluido"
MsgBox Now() - Tempo
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
Application.DisplayStatusBar = True

End Sub
Private Sub incluinaplan(ByVal strNome As String)
Dim intLinhaFim As Long, y As Long
intLinhaFim = Sheets(strNome).Cells(Rows.Count, 1).End(xlUp).Row + 1
With Sheets(strNome)
For y = 1 To UBound(vrTemp)
.Cells(intLinhaFim, y) = "'" & vrTemp(y)
Next
End With
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