Ir para conteúdo
Fórum Script Brasil

vinnygio

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre vinnygio

vinnygio's Achievements

0

Reputação

  1. - Boa Tarde, estou tentando implementar um código vba que transforma os dados da tabela a partir da célula A4 em TXT, para isso eu tenho uma condição de que alguns termos tem q ser preenchidos com espaços vazios para se encaixar no tamanho do padrão, mas toda vez que tento compilar da erro no inicio do código de Qualificador Inválido. Segue código: Option Explicit Sub GravarArquivoTxt() Open Range("B1").Value For Output As 1 Range("A4").Select Do While ActiveCell.Value <> "" Print #1, Replace(ActiveCell.Value, "/", "") _ & Cells(ActiveCell.Row, 2).Value + String(22 - Len(Cells(ActiveCell.Row, 2).Value), "") _ & Cells(ActiveCell.Row, 3).Value + String(22 - Len(Cells(ActiveCell.Row, 3).Value), "") _ & Cells(ActiveCell.Row, 4).Value + String(22 - Len(Cells(ActiveCell.Row, 4).Value), "") _ & Cells(ActiveCell.Row, 5).Value + String(22 - Len(Cells(ActiveCell.Row, 5).Value), "") _ & String(18 - Len(Replace(Cells(ActiveCell.Row, 6), ",", "").Value), "") + Replace(Cells(ActiveCell.Row, 6), ",", "").Value _ & Cells(ActiveCell.Row, 7).Value + String(30 - Len(Cells(ActiveCell.Row, 7).Value), "") _ & Cells(ActiveCell.Row, 8).Value + String(30 - Len(Cells(ActiveCell.Row, 8).Value), "") _ & Cells(ActiveCell.Row, 9).Value + String(250 - Len(Cells(ActiveCell.Row, 2).Value), "") _ & Cells(ActiveCell.Row, 10).Value + String(8 - Len(Cells(ActiveCell.Row, 10).Value), "") _ & Cells(ActiveCell.Row, 11).Value _ & Cells(ActiveCell.Row, 12).Value + String(100 - Len(Cells(ActiveCell.Row, 12).Value), "") _ & Cells(ActiveCell.Row, 13).Value + String(6 - Len(Cells(ActiveCell.Row, 13).Value), "") Cells(ActiveCell.Row + 1, ActiveCell.Column).Select Loop MsgBox "Arquivo gerado com sucesso!", vbInformation, "Ok" Close 1 End Sub Vocês poderiam me ajudar a solucionar o problema? Estou aprendendo ainda sobre VBA então meu código ficou um frankstein de métodos que vi antes.....
×
×
  • Criar Novo...