Solved

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

Posted on 2009-07-14
5
173 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:memeree
  • 3
  • 2
5 Comments
 
LVL 50

Accepted Solution

by:
Dave Brett earned 500 total points
ID: 24848359
like this ?

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

Open in new window

0
 
LVL 3

Author Comment

by:memeree
ID: 24848483
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 : & " | " & ?
0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 24848512
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

0
 
LVL 3

Author Closing Comment

by:memeree
ID: 31603209
sorry, just realised how lazy i was being.

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

Many Thanks
0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 24848555
thx :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question