Link to home
Start Free TrialLog in
Avatar of memeree
memereeFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Create a Pipe Separated Log (like CSV) but pipes?, file using Excel VBA

Hi everyone,

i have the attached code from another answer....

It does what i want it to do, but i need it to place a pipe ' | ' between 'application.username' and 'now', and so on, and in doing so, create a formatted file that can be importable back by excel in the correct way ...

I'm hoping it should be simple, but you never know..

Many Thanks

Open ThisWorkbook.Path & "\usage.log" For Append As #1
Print #1, Application.UserName, Now, etc, etc, etc, .........
Close #1

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dave
Dave
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of memeree

ASKER

close, but my problem is that i have around 50 different values on the print line; that ALL need to be separated by a pipe.

Is it possible to do this automatically? so that vba reads the commas on the second line  as : & " | " & ?
I'm afraid I don't understand

why don;t you continue in the same vein , ie

Print #1, Application.UserName & "|" & Now()  & "|" &"next"  & "|" & "next2"
etc

Or are you actually asking how to convert a line of text
Print #1, Application.UserName, Now, etc, etc, etc,
into
Print #1, Application.UserName   & "|" & Now  & "|" & etc  & "|" & etc  & "|" & etc
automatically?

Cheers
Dave

Avatar of memeree

ASKER

sorry, just realised how lazy i was being.

Control + H to replace all the commas with your suggestion above works perfectly.

Many Thanks
thx :)