outputting real values with dot instead of comma

T

T. S.

Hi there.
I am trying to write real values to a file, but excel always uses a
comma instead of a dot as delimiter.

Example:
--
Dim outfile As String
outfile="test.txt"
Open outfile For Output As #1
print #1, 5/2
print #1, 7/5
close #1
--

test.txt contains:
 
D

Dave Peterson

Untested, but I bet that excel picks up the decimal setting from Windows (under
control panel|regional settings applet).

But you could force things to be text:
print #1, replace(format(5/2,"0.00"),".",",")

Replace was added in xl2k. If you're using xl97, you could use:
print #1, application.substitute(format(5/2,"0.00"),".",",")
 
G

Gord Dibben

If running 2002 or 2003 you can also change the separators under
Tools>Options>International.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top