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: 3
Default exporting CSV numbers become text

I have an xls 2003 file with dates, text and currency values. I need to run a
macro to export to a CSV format. When run, the currency values convert to
text. I've tried various "pastespecial" options. But when I get the currency
to show up as numbers, the dates show up unformatted as integers, too.

Here is a sample of the Excel data:
1/3/2005 5.03.h.1 District 287 $65,658 Carl Perkins Grant
1/3/2005 5.03.h.2 District 287 $7,525 Tech Prep Grant

Here is what it looks like after a typical "pastespecial":
1/3/2005,5.03.h.1, 287,"$65,658",Carl Perkins Grant
1/3/2005,5.03.h.2, 287,"7,525",Tech Prep Grant

Here is my code:

Sub ExportToCSV()
' Save selected range as a CSV text file
Dim ThisBook As Workbook

ChDrive "S"
ChDir "S:\TECH\GEORGE\"

Set ThisBook = ActiveWorkbook
Selection.Copy

Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues ' one of several options used
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="TestForRichard.txt", FileFormat:=xlCSV
ActiveWorkbook.Close
Application.DisplayAlerts = True
ThisBook.Activate

End Sub

By the way, the exact range can change, meaning that the columns are NOT
always in the positions shown!

Thanks for any ideas or a thwack on the head for overlooking something
obvious.

George
 
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
Exporting numbers from Sql Server to Excel becomes text doofy Charts and Charting in Excel 0 December 18th 07 05:36 PM
Exporting Time Formatted Numbers inside Macros Don Excel Worksheet Functions 4 November 28th 06 07:56 PM
Mix of numbers/letters in same column - Error exporting Malte Sievers Excel Discussion (Misc queries) 1 December 2nd 05 01:03 AM
Exporting From Quickbooks-not formatting numbers Carrie Excel Discussion (Misc queries) 1 July 22nd 05 11:58 PM
Exporting numbers into Excel shedevel143 Excel Discussion (Misc queries) 1 December 11th 04 12:37 PM


All times are GMT +1. The time now is 10:20 PM.

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"