Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When I save the excel file as a tab

Status
Not open for further replies.

bnageshrao

Programmer
Mar 17, 2001
83
US
When I save the excel file as a tab delimited file using macro I came across a problem in which my date originally in the form of mm/dd/yyyy got saved in the form of m/d/yy. If I save the excel file using File - Save as Tab delimited text file it saves in the form of mm/dd/yyyy. Does any one knows why this happens and how do you write the date in the form of mm/dd/yyyy using macro to save the excel file as text format. Thanks
 
Hi bnageshrao,
Try the following in the place of your existing reference to a cell (I'm assuming you're creating the file by iterating through cells and writing them to the file):

Format(cellvalue,"mm/dd/yyyy")

This will convert the date to a string in mm/dd/yyyy format.

As to why it did it in the first place.. it's Microsoft....

Hope that helps!
 
I had tried that and it didnot help me, if you can try whether it works, then please let me know and send me the sample code. Thanks
 

bnageshrao
:

Format the cells as Text prior to saving the file as a Tab delimited text file. This should correct the problem.

You may send a copy of your macro to Excel@LoNeRaVeR.com and I'll take a look.

Regards,

LoNeRaVeR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top