Problem with saving REAL type to txt file

D

Domagoj Vulin

I have one little problem related to my post from yesterday.
I had to save a .txt file with spreadsheet data and that works fine, but the
problem is that my macro doesn't save REAL type with decimal point but it
saves like it is integer.
Example: if one cell has value 50.0, and I load the cell into a Single type
variable, when saved, it appears in txt file like 50 instead of 50. or 50.0
That's sort of problem, because it's input file for a old fortran
application which needs REAL type at that field.
 
D

Domagoj Vulin

Domagoj Vulin said:
I have one little problem related to my post from yesterday.
I had to save a .txt file with spreadsheet data and that works fine, but the
problem is that my macro doesn't save REAL type with decimal point but it
saves like it is integer.
Example: if one cell has value 50.0, and I load the cell into a Single type
variable, when saved, it appears in txt file like 50 instead of 50. or 50.0
That's sort of problem, because it's input file for a old fortran
application which needs REAL type at that field.
Solved, not quite elegant, so if someone has real solution of a problem...
Function MakeDecimal(MyValue)
If InStr(1, LTrim$(Str(MyValue)), ".") = 0 Then
MakeDecimal= LTrim$(Str(MyValue)) & "."
End If
End Function

The point is that in txt. file all is string.
 

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