Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default [Macro excel] How to create and export a sheet into a *.inp (or *.txt) file


Hi

I've got a little problem:
I would like to create with a macro a *.txt file in a specific folde
and copy the content of one the sheet on this *.txt file but I don'
know how to proceed.
In fact, I would be better for me to copy the content of this sheet i
a *.inp file (that is a quite weird extension), but a *.txt file woul
be good enough.

Thx for your hel

--
MrKermi
-----------------------------------------------------------------------
MrKermit's Profile: http://www.excelforum.com/member.php...fo&userid=3302
View this thread: http://www.excelforum.com/showthread.php?threadid=53146

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default [Macro excel] How to create and export a sheet into a *.inp (or *.txt) file

Something like this:

Sub NewTextFile()
Sheets("Sheet1").Copy
ChDir "C:\" 'your folder path
ActiveWorkbook.SaveAs Filename:="C:\Book2.txt", FileFormat:=xlText, _
CreateBackup:=False
End Sub

Mike F
"MrKermit" wrote in
message ...

Hi

I've got a little problem:
I would like to create with a macro a *.txt file in a specific folder
and copy the content of one the sheet on this *.txt file but I don't
know how to proceed.
In fact, I would be better for me to copy the content of this sheet in
a *.inp file (that is a quite weird extension), but a *.txt file would
be good enough.

Thx for your help


--
MrKermit
------------------------------------------------------------------------
MrKermit's Profile:
http://www.excelforum.com/member.php...o&userid=33021
View this thread: http://www.excelforum.com/showthread...hreadid=531464



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default [Macro excel] How to create and export a sheet into a *.inp (o

You might want to add

Sub NewTextFile()
Sheets("Sheet1").Copy
'ChDir "C:\" 'your folder path
ActiveWorkbook.SaveAs Filename:="C:\Book2.txt", _
FileFormat:=xlText, _
CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=False
End Sub

You also don't need to chdir since the path is specified in the file name.
If you did need to Chdir, you should also Chdrive as well.

--
Regards,
Tom Ogilvy



"Mike Fogleman" wrote:

Something like this:

Sub NewTextFile()
Sheets("Sheet1").Copy
ChDir "C:\" 'your folder path
ActiveWorkbook.SaveAs Filename:="C:\Book2.txt", FileFormat:=xlText, _
CreateBackup:=False
End Sub

Mike F
"MrKermit" wrote in
message ...

Hi

I've got a little problem:
I would like to create with a macro a *.txt file in a specific folder
and copy the content of one the sheet on this *.txt file but I don't
know how to proceed.
In fact, I would be better for me to copy the content of this sheet in
a *.inp file (that is a quite weird extension), but a *.txt file would
be good enough.

Thx for your help


--
MrKermit
------------------------------------------------------------------------
MrKermit's Profile:
http://www.excelforum.com/member.php...o&userid=33021
View this thread: http://www.excelforum.com/showthread...hreadid=531464




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default [Macro excel] How to create and export a sheet into a *.inp (or *.txt) file


Ok thanks, i'm gonna tr

--
MrKermi
-----------------------------------------------------------------------
MrKermit's Profile: http://www.excelforum.com/member.php...fo&userid=3302
View this thread: http://www.excelforum.com/showthread.php?threadid=53146

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
How do i create macro for export excel data to word in to letters C-va Excel Discussion (Misc queries) 1 February 18th 10 02:47 PM
how do i create a macro to export a chart to powerpoint? NPAT Charts and Charting in Excel 1 November 16th 07 10:23 AM
Need to export file name to users sheet to the next row Brad Excel Programming 3 April 29th 05 09:14 PM
A macro to export a sheet as UTF8 encoded Unicode file Dario de Judicibus Excel Programming 5 November 21st 03 07:11 AM
Do you know how to create a new sheet in a file by macro? dukejas[_2_] Excel Programming 2 November 8th 03 12:56 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"