Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Open .txt, Save as .xls from command line

If your text file is always the same name, then start a new workbook.
Turn on the macro recorder and record your steps when you do it manually.

Save that workbook as a nice name. You could open that workbook and run the
macro whenever you want to import that text file.

Or you could give the macro the name: Auto_open

Then put a shortcut to that workbook on your desktop. Just double click on the
shortcut, excel will open your file, run the macro and tada!

You could even add:

Thisworkbook.close savechanges:=false

right before the closing "end sub"

and the macro workbook will close (without saving any changes--so don't do this
while you're testing if you haven't saved it!)

graham wrote:

I think the subject says it all! I have a txt file that I receive daily that I would like to create a .bat file to open, delimit based on 'space', and save as a xls file.

I'm clueless, any help would be greatly appreciated!

THANKS!


--

Dave Peterson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default Open .txt, Save as .xls from command line

perfect, Thanks.

One additional question if I may:

What if I want to close excel.exe completely, not just the workbook?

"Dave Peterson" wrote:

If your text file is always the same name, then start a new workbook.
Turn on the macro recorder and record your steps when you do it manually.

Save that workbook as a nice name. You could open that workbook and run the
macro whenever you want to import that text file.

Or you could give the macro the name: Auto_open

Then put a shortcut to that workbook on your desktop. Just double click on the
shortcut, excel will open your file, run the macro and tada!

You could even add:

Thisworkbook.close savechanges:=false

right before the closing "end sub"

and the macro workbook will close (without saving any changes--so don't do this
while you're testing if you haven't saved it!)

graham wrote:

I think the subject says it all! I have a txt file that I receive daily that I would like to create a .bat file to open, delimit based on 'space', and save as a xls file.

I'm clueless, any help would be greatly appreciated!

THANKS!


--

Dave Peterson


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Open .txt, Save as .xls from command line

Right before the "End Sub"

application.Quit
'then
End Sub


graham wrote:

perfect, Thanks.

One additional question if I may:

What if I want to close excel.exe completely, not just the workbook?

"Dave Peterson" wrote:

If your text file is always the same name, then start a new workbook.
Turn on the macro recorder and record your steps when you do it manually.

Save that workbook as a nice name. You could open that workbook and run the
macro whenever you want to import that text file.

Or you could give the macro the name: Auto_open

Then put a shortcut to that workbook on your desktop. Just double click on the
shortcut, excel will open your file, run the macro and tada!

You could even add:

Thisworkbook.close savechanges:=false

right before the closing "end sub"

and the macro workbook will close (without saving any changes--so don't do this
while you're testing if you haven't saved it!)

graham wrote:

I think the subject says it all! I have a txt file that I receive daily that I would like to create a .bat file to open, delimit based on 'space', and save as a xls file.

I'm clueless, any help would be greatly appreciated!

THANKS!


--

Dave Peterson



--

Dave Peterson

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
Save as Command Line SoDakRah Excel Discussion (Misc queries) 1 July 29th 08 06:12 PM
Open, Save and close Excel 2007 file with a cmd command Hugo Pinto Excel Discussion (Misc queries) 5 March 3rd 08 10:05 PM
Command line to open a specific worksheet vIQleS Excel Worksheet Functions 2 December 1st 06 12:46 AM
How do i convert excel to csv in command line? ( not save as) F1 Excel Discussion (Misc queries) 1 June 1st 05 03:51 AM
can i save an existing .xls file as a .csv file using command line craigkan Excel Discussion (Misc queries) 2 February 18th 05 02:01 PM


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