|
-
Jan 12th, 2004, 02:09 PM
#1
Thread Starter
New Member
Exporting Excel file items to a text file
Hello Friends,
I have a Excel file and i need to write a macro to export 1st column fields to a text file in which all the field elements are seperated by coma..could u pl suggest me how to do that, sample code will be helpful
Thanks
-
Jan 12th, 2004, 02:19 PM
#2
Hyperactive Member
-
Jan 13th, 2004, 04:28 PM
#3
Thread Starter
New Member
Hello, this is not helping me, could u pl provide the code, what i need to do is copy certain range excel file and paste them in a text file seperated by comas, if i can write a macro that will be very helpful
Thanks
-
Jan 13th, 2004, 08:12 PM
#4
Copy the range of data you want to save to a new sheet then use the below.
Code:
'Save as a text file
objExcel.ActiveWorkbook.SaveAs FileName:=C:\Test.txt, FileFormat:=xlText
-
Jan 14th, 2004, 10:24 AM
#5
Thread Starter
New Member
Using this i am getting object failed error and i do not have help, could u give me the exact code please, thx
-
Jan 14th, 2004, 07:34 PM
#6
This is to open the spreadsheet.
Code:
Dim oXLApp As Object
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
Set oXLApp = objExcel.Workbooks.Open(FileName:=C:\Book1.xls)
objExcel.Visible = False 'show excel or not
objExcel.DisplayAlerts = False
objExcel.WorkSheets("Sheet1").Select ' Select sheet to work with
and this is now to save as a txt file.
Code:
objExcel.ActiveWorkbook.SaveAs FileName:=C:\Test.txt, FileFormat:=xlText
HTH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|