Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

867 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

16 Experts available now in Live!

Get 1:1 Help Now