Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Write/Print Statements, and date formats


Hi everyone

I'm using the Write and Print statements to write out data from a
Excel spreadsheet to text files that need a very specific format.

When I have cell in the Excel spreadsheet which is a Date Type, th
format of the value is not written out the way I want it. I want th
output text file to look exactly the way it looks in the Exce
spreadsheet. I may have a cell formatted as "[hh]:mm:ss". But a cel
with "00:00:00" then looks like just "0" in the text file. And a cel
that looks like "-00:00:05" in the Excel spreadsheet shows up a
"-5.78703703703704E-05" in the text file..

How can I tell VBA to write out the cell value exactly as it appears i
the worksheet?

If I use "Save As" to save the file as a .csv file, it DOES print th
cell values exactly the way they appear in the cells. This is what
want. (Unfortunately, my text files also have to contain a bunch o
other formatting that the "Save As" function can not do, so I need m
own program to do it.)

Please let me know if you have any ideas.
Thanks!

Emm

--
embirat
-----------------------------------------------------------------------
embirath's Profile: http://www.excelforum.com/member.php...fo&userid=3720
View this thread: http://www.excelforum.com/showthread.php?threadid=57157

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Write/Print Statements, and date formats

My bet is you're writing .value. Try writing .text.

mycell.value
is replaced with
mycell.Text



embirath wrote:

Hi everyone

I'm using the Write and Print statements to write out data from an
Excel spreadsheet to text files that need a very specific format.

When I have cell in the Excel spreadsheet which is a Date Type, the
format of the value is not written out the way I want it. I want the
output text file to look exactly the way it looks in the Excel
spreadsheet. I may have a cell formatted as "[hh]:mm:ss". But a cell
with "00:00:00" then looks like just "0" in the text file. And a cell
that looks like "-00:00:05" in the Excel spreadsheet shows up as
"-5.78703703703704E-05" in the text file..

How can I tell VBA to write out the cell value exactly as it appears in
the worksheet?

If I use "Save As" to save the file as a .csv file, it DOES print the
cell values exactly the way they appear in the cells. This is what I
want. (Unfortunately, my text files also have to contain a bunch of
other formatting that the "Save As" function can not do, so I need my
own program to do it.)

Please let me know if you have any ideas.
Thanks!

Emma

--
embirath
------------------------------------------------------------------------
embirath's Profile: http://www.excelforum.com/member.php...o&userid=37202
View this thread: http://www.excelforum.com/showthread...hreadid=571570


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Write/Print Statements, and date formats


Ah.... Thank you!!!!!

I love when there are such simple solutions :-) :-)
Emma


--
embirath
------------------------------------------------------------------------
embirath's Profile: http://www.excelforum.com/member.php...o&userid=37202
View this thread: http://www.excelforum.com/showthread...hreadid=571570

Reply
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
how do I write a formula for If And statements ex. if = to ? and MacroLearning New Users to Excel 6 December 19th 06 07:28 PM
How would I write a max formula that included color formats? trainer07 Excel Discussion (Misc queries) 2 April 25th 06 12:05 AM
How do I write If then statements? If...Then Statement Excel Programming 2 April 18th 06 04:27 AM
How to write a macro to print a dir on my c drive Tony Excel Programming 2 May 28th 05 11:54 PM
iF STATEMENTS WITHIN CONDITIONAL FORMATS E Halliday Excel Worksheet Functions 4 February 23rd 05 01:05 AM


All times are GMT +1. The time now is 03:14 AM.

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

About Us

"It's about Microsoft Excel"