[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Formatted output to text file

simonc

12/15/2006 11:22:00 AM

I know there is a simple answer to this, but I can't seem to find it in the
help file. I am using the VBA print# statement to create a text file with
numbers in right justified columns. One of the columns will contain a
floating point value and I need to contol the output width of this so it
lines up correctly. I don't want to use a fixed decimal point format because
the output number might be anywhere in the range of 100000+ to less than 1,
so I need to control the output to a fixed number of significant figures. I
am sure there's a parameter where you can set the width of an output string,
but I can't find it. Can anyone help?

Thanks
1 Answer

Martin Fishlock

12/15/2006 12:19:00 PM

0

Simon:

You can use spc(x) or tab(x).

In your situation it is probably easier to print the integer part and then
the decimal.
using format to get the right spacing.
--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"simonc" wrote:

> I know there is a simple answer to this, but I can't seem to find it in the
> help file. I am using the VBA print# statement to create a text file with
> numbers in right justified columns. One of the columns will contain a
> floating point value and I need to contol the output width of this so it
> lines up correctly. I don't want to use a fixed decimal point format because
> the output number might be anywhere in the range of 100000+ to less than 1,
> so I need to control the output to a fixed number of significant figures. I
> am sure there's a parameter where you can set the width of an output string,
> but I can't find it. Can anyone help?
>
> Thanks