LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Export Date Format

Help on formatting date exported to text file!!

I am exporting data to a text file (appending if existing, creating if not).
I have one date field but am exporting everything as text. I want the
date to be in the form mmddyyyy (no slashes and always 8 characters).

I use the following code to pick the data from the sheet and export it.
All works well and the date on the sheet is formatted to look the way I want
it to look. However, in the text file it is formatted with slashes and no
leading zeros.
I found Tom Ogilvy's method to export a single cell in a format but don't
see how to imbed this in my string(s). The date is in Column B.

All suggestions gratefully accepted.


Dim ff As Integer
ff = FreeFile()
Lastrecord = 1
FirstCol = 1
LastCol = 24
Dim FirstFind As Range
Set FirstFind = Range("W1:W100").Find(what:="No Data", _
LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If Not FirstFind Is Nothing Then
Lastrecord = FirstFind.Row - 1
Else: GoTo Error
End If
'Now output the data to a text batch file
Sheets("BatchFile").Select
Open "L:\ CheckRequests\BatchFile.txt" For Append As ff
For r = Firstrecord To Lastrecord
For C = FirstCol To LastCol
Print #ff, Cells(r, C) & vbTab;
Next C
Print #ff, 'blank line
Next r
Close ff
--

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export Format basic Excel Discussion (Misc queries) 19 August 11th 08 09:44 PM
Export a spreadsheet and keep format Barb Excel Discussion (Misc queries) 1 May 16th 06 12:52 PM
Format of CSV File in export [email protected] Excel Programming 4 September 8th 05 07:34 PM
Date format problem on export to CSV Nijk Excel Programming 2 June 27th 05 11:51 AM
export cell value - Date Format John Excel Programming 2 June 24th 05 07:33 PM


All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"