How to write accurate fully qualified numerical data to an ascii file from Excel using VBA

Hey Experts,

I am trying to create an ASCII file from data on an Excel spreadsheet using VBA code. Everything is working wonderfully except that large numbers are being formatted on the file with scientific notation and some of the numbers are having their decimal places rounded. These are monetary amounts so I need them to be 2 decimal places as represented in the spreadsheet.

Any ideas about how to get the data written to the ASCII file as formatted on the spreadsheet?

Thanks,

taduh
taduhFinancial Systems AnalystAsked:
Who is Participating?
 
taduhFinancial Systems AnalystAuthor Commented:
Figured it out - I used the Text function to define the format of the number before I appended it to the record and wrote it to the file:

hfmamt = Application.Text(Range("hfmamt").Value, "0.00")

Thanks anyway,

taduh
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.