A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

export excelsheet into text file



 
 
Thread Tools Display Modes
  #1  
Old October 23rd, 2003, 02:56 PM
Mili
external usenet poster
 
Posts: n/a
Default export excelsheet into text file

How to export excel work sheet into a text file.

Regards

Mili
  #2  
Old October 23rd, 2003, 03:02 PM
jaf
external usenet poster
 
Posts: n/a
Default export excelsheet into text file

Filesave as. There are several text format options.


--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
How to export excel work sheet into a text file.

Regards

Mili



  #3  
Old October 23rd, 2003, 03:11 PM
Mili
external usenet poster
 
Posts: n/a
Default export excelsheet into text file

Hi
I am using following code, not getting how to save the
text file to a directory.

Code :
-------------------------
Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName = Application.GetSaveAsFilename
(InitialFileName:=CStr(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
'TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

Regards

Mili.
-----Original Message-----
Filesave as. There are several text format options.


--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
How to export excel work sheet into a text file.

Regards

Mili



.

  #4  
Old October 23rd, 2003, 03:34 PM
jaf
external usenet poster
 
Posts: n/a
Default export excelsheet into text file

Hi Mili,

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CSt r(ActiveSheet.Name),filefi
lter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
ThisWorkbook.SaveAs FileSaveName '
End Sub

OR...

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As Object '
Set TextExportExcel = ThisWorkbook '
'MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CSt r(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
'MsgBox " FileSaveName :" & FileSaveName
TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
Hi
I am using following code, not getting how to save the
text file to a directory.

Code :
-------------------------
Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName = Application.GetSaveAsFilename
(InitialFileName:=CStr(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
'TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

Regards

Mili.
-----Original Message-----
Filesave as. There are several text format options.


--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
How to export excel work sheet into a text file.

Regards

Mili



.



  #5  
Old October 23rd, 2003, 04:18 PM
Mili
external usenet poster
 
Posts: n/a
Default export excelsheet into text file

Hi
Thanks for the help. I want store only the text
present in the selected Cell in Excel.

and for importing text file to Excel I am using following
code. How to proceed ???

code :
---------------------------------------------------------
Public Sub DisplayLastLogInformation()
Const LogFileName As String = "C:\test\test.txt" 'content
of test file are column1,column2,column3,column4,clumn5
Dim FileNum As Integer, tLine As String
FileNum = FreeFile ' next file number
Open LogFileName For Input Access Read Shared As
#FileNum ' open the file for reading
Do While Not EOF(FileNum)
Line Input #FileNum, tLine ' read a line from the
text file
Loop ' until the last line is read
Close #FileNum ' close the file
MsgBox tLine, vbInformation, "Last log information:"
End Sub
---------------------------------------------------------

Regards

Mili
-----Original Message-----
Hi Mili,

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CS tr

(ActiveSheet.Name),filefi
lter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
ThisWorkbook.SaveAs FileSaveName '
End Sub

OR...

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As Object '
Set TextExportExcel = ThisWorkbook '
'MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CS tr

(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
'MsgBox " FileSaveName :" & FileSaveName
TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
Hi
I am using following code, not getting how to save the
text file to a directory.

Code :
-------------------------
Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName = Application.GetSaveAsFilename
(InitialFileName:=CStr(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
'TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

Regards

Mili.
-----Original Message-----
Filesave as. There are several text format options.


--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
How to export excel work sheet into a text file.

Regards

Mili


.



.

  #6  
Old October 23rd, 2003, 04:20 PM
Mili
external usenet poster
 
Posts: n/a
Default export excelsheet into text file

Hi
Thanks for the help. I want store only the text
present in the selected Cell in Excel.

and for importing text file to Excel I am using following
code. How to proceed ???

code :
---------------------------------------------------------
Public Sub DisplayLastLogInformation()
Const LogFileName As String = "C:\test\test.txt" 'content
of test file are column1,column2,column3,column4,clumn5
Dim FileNum As Integer, tLine As String
FileNum = FreeFile ' next file number
Open LogFileName For Input Access Read Shared As
#FileNum ' open the file for reading
Do While Not EOF(FileNum)
Line Input #FileNum, tLine ' read a line from the
text file
Loop ' until the last line is read
Close #FileNum ' close the file
MsgBox tLine, vbInformation, "Last log information:"
End Sub
---------------------------------------------------------

Regards

Mili
-----Original Message-----
Hi Mili,

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CS tr

(ActiveSheet.Name),filefi
lter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
ThisWorkbook.SaveAs FileSaveName '
End Sub

OR...

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As Object '
Set TextExportExcel = ThisWorkbook '
'MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CS tr

(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
'MsgBox " FileSaveName :" & FileSaveName
TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
Hi
I am using following code, not getting how to save the
text file to a directory.

Code :
-------------------------
Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName = Application.GetSaveAsFilename
(InitialFileName:=CStr(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
'TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

Regards

Mili.
-----Original Message-----
Filesave as. There are several text format options.


--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
How to export excel work sheet into a text file.

Regards

Mili


.



.

  #7  
Old October 23rd, 2003, 07:22 PM
jaf
external usenet poster
 
Posts: n/a
Default export excelsheet into text file

Hi Mili,
This should do what you want.
You may need to do/add a texttocolumns. I don't know how your data is
formatted.
(watch the line wraps)

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As Object
Set TextExportExcel = ThisWorkbook
Dim c As Object
Dim MyRange As Object
Set MyRange = ActiveCell.CurrentRegion.Rows
mypath = "c:\test\" 'set path to folder here
'or use mypath=Application.DefaultFilePath
'MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName = Application.GetSaveAsFilename(InitialFileName:=CSt r(mypath &
ActiveSheet.Name),

filefilter:="Text Files (*.txt), *.txt")
'MsgBox " FileSaveName :" & FileSaveName

WriteFile MyRange, FileSaveName
End Sub

Sub WriteFile(MyRange, FileSaveName)


Dim FF As Integer, MyLine As String
FF = 0
FileNum = FreeFile ' next file number
Open FileSaveName For Append As #FileNum ' open the file & add currently
selected data to the file

(or create it)
'use output instead of append if you want to overwrite the entire file
each time
For Each c In MyRange 'c=rows in range
'assuming five columns of data to be written to file
Print #FileNum, Cells(c.Row, c.Column).Text, Cells(c.Row, c.Column +
1).Text, Cells(c.Row, c.Column +

2).Text, Cells(c.Row, c.Column + 3).Text, Cells(c.Row, c.Column + 4).Text
Next

Close #FileNum ' close the file
'MsgBox MyLine, vbInformation, "Last log information:"

End Sub

Public Sub DisplayLastLogInformation()
Const LogFileName As String = "C:\test\test.txt" 'contentof test file are

column1,column2,column3,column4,clumn5
Dim FileNum As Integer, tLine As String
FileNum = 0: n = 0
FileNum = FreeFile ' next file number
Open LogFileName For Input Access Read Shared As #FileNum ' open the
file for reading

ThisWorkbook.Sheets("sheet2").Activate
Cells(1, 1).Select

Do While Not EOF(FileNum)
Line Input #FileNum, tLine ' read a line from the Text File
n = n + 1 'row counter

Sheets("sheet2").Cells(n, 1) = tLine

Loop ' until the last line is read
Close #FileNum ' close the file


MsgBox tLine, vbInformation, "Last log information:"
End Sub


--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
Hi
Thanks for the help. I want store only the text
present in the selected Cell in Excel.

and for importing text file to Excel I am using following
code. How to proceed ???

code :
---------------------------------------------------------
Public Sub DisplayLastLogInformation()
Const LogFileName As String = "C:\test\test.txt" 'content
of test file are column1,column2,column3,column4,clumn5
Dim FileNum As Integer, tLine As String
FileNum = FreeFile ' next file number
Open LogFileName For Input Access Read Shared As
#FileNum ' open the file for reading
Do While Not EOF(FileNum)
Line Input #FileNum, tLine ' read a line from the
text file
Loop ' until the last line is read
Close #FileNum ' close the file
MsgBox tLine, vbInformation, "Last log information:"
End Sub
---------------------------------------------------------

Regards

Mili
-----Original Message-----
Hi Mili,

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CS tr

(ActiveSheet.Name),filefi
lter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
ThisWorkbook.SaveAs FileSaveName '
End Sub

OR...

Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As Object '
Set TextExportExcel = ThisWorkbook '
'MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName =
Application.GetSaveAsFilename(InitialFileName:=CS tr

(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
'MsgBox " FileSaveName :" & FileSaveName
TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
Hi
I am using following code, not getting how to save the
text file to a directory.

Code :
-------------------------
Sub FileSaver()
Dim FileSaveName As String
Dim TextExportExcel As ThisWorkbook
MsgBox "Text File Name := " & ActiveSheet.Name
FileSaveName = Application.GetSaveAsFilename
(InitialFileName:=CStr(ActiveSheet.Name),
filefilter:="Text Files (*.txt), *.txt")
MsgBox " FileSaveName :" & FileSaveName
'TextExportExcel.SaveAs Filename:=FileSaveName
End Sub

Regards

Mili.
-----Original Message-----
Filesave as. There are several text format options.


--

John

johnf202 at hotmail dot com


"Mili" wrote in message
...
How to export excel work sheet into a text file.

Regards

Mili


.



.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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