Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey
 
Posts: n/a
Default Why can't I Export selected cells to tab-delimited text file?

This macro is fairly simple to implement:

Public Sub ExportSelectionAsDelimitedFile()
Const sDELIM As String = vbTab
Const sPATH As String = "<your path here"
Const sFILENAME As String = "test.txt"
Dim rArea As Range
Dim rRow As Range
Dim rCell As Range
Dim nFile As Long
Dim sRow As String
If TypeOf Selection Is Range Then
nFile = FreeFile
Open sPATH & sFILENAME For Output As nFile
For Each rArea In Selection.Areas
For Each rRow In rArea.Rows
sRow = ""
For Each rCell In rRow.Cells
sRow = sRow & sDELIM & rCell.Text
Next rCell
Print #nFile, Mid(sRow, Len(sDELIM) + 1)
Next rRow
Next rArea
Close #nFile
End If
End Sub


In article ,
"Lisa B." wrote:

This should be an easy thing to do.

I'd like to set up a "refreshable" text export, in much the same way that
you can set up a "refreshable" text import.

Maybe I'm missing something, but it seems that Excel has little in the way
of Export capability.

Yes, I know there is a slightly more cumbersome way of doing this:
copy - open text file - paste - close text file - click "yes" in save
dialog.

Lisa B.

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dana DeLouis
 
Posts: n/a
Default Why can't I Export selected cells to tab-delimited text file?

Don't know if this would help, but another option might be:
File | Save as Web page...
Then check "Selection"

Not quite a "Tab-delimited" file, but it may give you some other ideas to
work with.
Not sure, but there is also Data | Import external data... Perhaps you can
point to your data here.

--
Dana DeLouis
Win XP & Office 2003


"JE McGimpsey" wrote in message
...
This macro is fairly simple to implement:

Public Sub ExportSelectionAsDelimitedFile()
Const sDELIM As String = vbTab
Const sPATH As String = "<your path here"
Const sFILENAME As String = "test.txt"
Dim rArea As Range
Dim rRow As Range
Dim rCell As Range
Dim nFile As Long
Dim sRow As String
If TypeOf Selection Is Range Then
nFile = FreeFile
Open sPATH & sFILENAME For Output As nFile
For Each rArea In Selection.Areas
For Each rRow In rArea.Rows
sRow = ""
For Each rCell In rRow.Cells
sRow = sRow & sDELIM & rCell.Text
Next rCell
Print #nFile, Mid(sRow, Len(sDELIM) + 1)
Next rRow
Next rArea
Close #nFile
End If
End Sub


In article ,
"Lisa B." wrote:

This should be an easy thing to do.

I'd like to set up a "refreshable" text export, in much the same way that
you can set up a "refreshable" text import.

Maybe I'm missing something, but it seems that Excel has little in the
way
of Export capability.

Yes, I know there is a slightly more cumbersome way of doing this:
copy - open text file - paste - close text file - click "yes" in save
dialog.

Lisa B.



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
Linked cells and text boxes Alexlondon11 Excel Discussion (Misc queries) 2 November 23rd 05 04:10 PM
Search/Extract Data w/in Text File D.Parker Excel Discussion (Misc queries) 4 June 21st 05 07:33 PM
Can delimited text file imports be extracted to a single column i. JROD Excel Discussion (Misc queries) 1 April 1st 05 05:57 AM
saving excel file as tab delimited Craig Hilliard Excel Discussion (Misc queries) 0 February 1st 05 10:39 PM
Convert text file to MS_Excel Aqua Flow Excel Discussion (Misc queries) 1 November 30th 04 02:55 AM


All times are GMT +1. The time now is 09:11 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"