Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Write formated excel values into text file
Hi there,
i try to write a selected range by a user into a .txt file. Here is the code: Sub WriteFile() Dim OutputFile As String OutputFile = "C:\test.txt" Dim myRange As Range Set myRange = Selection Open OutputFile For Output As #1 For Each rngCell In myRange.Cells inhalt = Cells(rngCell.Row, rngCell.Column).Value 'inhalt = Mid(inhalt, 2, 2) Print #1, inhalt Next rngCell Close #1 End Sub All text values are written well. But for example: Excel value: 10:15:00 AM Text File value: 0.427083333333333 How can i make that he writes the proper values? Thank you for help! greetz kaiserlich |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Write formated excel values into text file
Hi
Use .Text rather than .Value Alok "kaiserlich" wrote: Hi there, i try to write a selected range by a user into a .txt file. Here is the code: Sub WriteFile() Dim OutputFile As String OutputFile = "C:\test.txt" Dim myRange As Range Set myRange = Selection Open OutputFile For Output As #1 For Each rngCell In myRange.Cells inhalt = Cells(rngCell.Row, rngCell.Column).Value 'inhalt = Mid(inhalt, 2, 2) Print #1, inhalt Next rngCell Close #1 End Sub All text values are written well. But for example: Excel value: 10:15:00 AM Text File value: 0.427083333333333 How can i make that he writes the proper values? Thank you for help! greetz kaiserlich |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open CSV file, format data and write output to a text file. | Excel Programming | |||
Create and write a simple text file in Excel/VBA | Excel Programming | |||
opening and write to a text file in excel | Excel Programming | |||
write a line from Excel to a text file | Excel Programming | |||
VB6 - ADO - Excel XP, cell formated as text | Excel Programming |