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
#35937
Tenho uma macro para isso, só que preciso tirar a opção de terminar sem "|", como posso fazer? Segue a Macro:
Código: Selecionar todos
 ExpExcelTxT()
Dim SrcRg As Range
Dim CurrRow As Range
Dim CurrCell As Range
Dim CurrTextStr As String
Dim ListSep As String
Dim DataTextStr As String

ListSep = "|"
Set SrcRg = ActiveSheet.UsedRange

Open "C:\Users\Carlos André\Desktop\ArqExp.txt" For Output As #1

For Each CurrRow In SrcRg.Rows
    CurrTextStr = ""
    For Each CurrCell In CurrRow.Cells
        CurrTextStr = CurrTextStr & CurrCell.Value & ListSep
    Next
    While Right(CurrTextStr, 1) = ListSep
        CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) - 1)
    Wend
    CurrTextStr = CurrTextStr & ListSep
    Print #1, CurrTextStr
Next
Close #1
End Sub
Avatar do usuário
Por Reinaldo
Avatar
#35938
O trecho abaixo elimina, para cada linha o ultimo caractere se esse for "|", se deseja que tenha esse caractere, iniba/comente ou exclua essas linhas
Código: Selecionar todos
 ...  
 While Right(CurrTextStr, 1) = ListSep
        CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) - 1)
    Wend
....
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