Solved

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

Posted on 2009-07-14
5
170 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now