Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello & help!!!
I'm all goofed up here, tried many things myself, and have failed miserably (Excel 2000). Anyway, I need to export a range named EXPORTRANGE as .csv format to C:\Lotus\Work\123, with the file name bake.csv. The range is getting saved to the current directory (instead of C:\Lotus\Work\123), with the name bakeadj.csv. I did see something about DIR returning the first found file name in the directory, but couldn't figure out what to do about it; bakeadj.csv is the first file. In addition to that, the exported range does not put any commas in the file, just blank cells. Thanks for any help you can give me. Totally messed up (and probably laughable) code follows: Dim SrcRg As Range Dim CurrRow As Range Dim CurrCell As Range Dim CurrTextStr As String Dim ListSep As String Dim FName As String Dim destpathname As String Dim ColCount As Integer Dim CurrCol As Integer Dim filemask As String destpathname = "C:\Lotus\Work\123\" filemask = "bake.csv" FName = Dir(destpathname & filemask, vbNormal) ListSep = Application.International(xlListSeparator) Range("EXPORTRANGE").Select Set SrcRg = Selection ColCount = SrcRg.Columns.Count Open FName For Output As #1 For Each CurrRow In SrcRg.Rows CurrCol = 0 CurrTextStr = "" For Each CurrCell In CurrRow.Cells CurrCol = CurrCol + 1 CurrTextStr = CurrTextStr & CurrCell.Value & IIf(CurrCol < _ ColCount, ListSep, "") Next Print #1, CurrTextStr Next Close #1 End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
exporting/saving recent files list | Excel Discussion (Misc queries) | |||
Exporting / Saving as XML | Excel Discussion (Misc queries) | |||
Exporting txt file | Excel Discussion (Misc queries) | |||
Exporting to csv file | Excel Discussion (Misc queries) | |||
Exporting CSV file to unicode .txt file - " around strings | Excel Discussion (Misc queries) |