|
Question : Excel dollar amount to text, zero fill to left, no decimal, respect 2 positions for cents
|
|
I would like to solve this issue once and for all. I have create such crazy work-arounds to handle this issue over the years we won't go into... I simply have a need to feed a mainframe system with fixed-format transactions where the amount fields are zero filled to the right, have no decimal, and where the 2 positions for the cents is respected. So that $1,254.98 is spit out as 000125498. My Lord that seems like a no-brainer but I just cannot get it to do it.
I need it to work seamless/automatic, even if I have to pick up the Excel sheet in Access and make-table and transfer text etc. As long as the end result is push button. Ideally I would like to have a way to do it in Excel only and an Excel + Access solution so I could create a little Access app to suck in a sheet and create the necessary batch transactions.
Thanks.
|
|
Answer : Excel dollar amount to text, zero fill to left, no decimal, respect 2 positions for cents
|
|
You should write the file directly. Here are code samples under File I/O in VB:
http://puma.agron.ksu.edu/~sgsax/download/
Then, to format your amount field:
strField = Right(String(9, "0") & Int(curAmount * 100), 9)
/gustav
|
|
|
|