Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Linked cells and text boxes | Excel Discussion (Misc queries) | |||
Search/Extract Data w/in Text File | Excel Discussion (Misc queries) | |||
Can delimited text file imports be extracted to a single column i. | Excel Discussion (Misc queries) | |||
saving excel file as tab delimited | Excel Discussion (Misc queries) | |||
Convert text file to MS_Excel | Excel Discussion (Misc queries) |