Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default DOS batch files

After a workbook is closed, is it possible to run a
macro that executes a DOS BAT file? How would
I do that?




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default DOS batch files

On second thought......

I think I might NOT need to run a DOS script at all.
The DOS BAT file I had in mind simply overwrites
a file, or deletes that file and replaces it with a new
file.

Therefore, I guess my question should be, how can I
replace a target file after a Workbook is closed?



"Robert Crandal" wrote in message
...
After a workbook is closed, is it possible to run a
macro that executes a DOS BAT file? How would
I do that?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default DOS batch files

On May 26, 6:51*am, "Robert Crandal" wrote:
On second thought......

I think I might NOT need to run a DOS script at all.
The DOS BAT file I had in mind simply overwrites
a file, or deletes that file and replaces it with a new
file.

Therefore, I guess my question should be, how can I
replace a target file after a Workbook is closed?

"Robert Crandal" wrote in message

...



After a workbook is closed, is it possible to run a
macro that executes a DOS BAT file? *How would
I do that?- Hide quoted text -


- Show quoted text -


Just open your Excel file from the .bat
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default DOS batch files

I probably wasn't clear, so I'll reword my question:

Upon exiting a workbook, I need to run a VBA macro that
deletes and replaces a specified file (or overwrites the
contents of that file with new data). BAT files are out
of the picture now......


"James Ravenswood" wrote in message
...

After a workbook is closed, is it possible to run a
macro that executes a DOS BAT file? How would
I do that?- Hide quoted text -


- Show quoted text -


Just open your Excel file from the .bat

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default DOS batch files

"Robert Crandal" wrote in message
...
I probably wasn't clear, so I'll reword my question:

Upon exiting a workbook, I need to run a VBA macro that
deletes and replaces a specified file (or overwrites the
contents of that file with new data). BAT files are out
of the picture now......



Maybe. If your users would consistently / reliably use a shortcut that
invoked a .BAT script which opened the workbook and waited for the
process to complete before continuing you would have a very simple
solution. << IF

Does the workbook in question actually need to be closed for the
operations to take place, or are the operations happening to a different
file?

If a different file, put the VBA code in the Workbook.Close event.

If the same file, post back and either myself or someone else can help
you design code that will run after your workbook has finished exiting.

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default DOS batch files

"Clif McIrvin" wrote in message
...

Does the workbook in question actually need to be closed for the
operations to take place, or are the operations happening to a different
file?

If a different file, put the VBA code in the Workbook.Close event.

If the same file, post back and either myself or someone else can help you
design code that will run after your workbook has finished exiting.


Basically, I need to put VBA code in Workbook.Close() that
deletes a file on the C: drive named "orders.txt". Then I need
to create a new replacement file named "orders.txt" which I
will write my own data into.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default DOS batch files

"Robert Crandal" wrote in message
...
"Clif McIrvin" wrote in message
...

Does the workbook in question actually need to be closed for the
operations to take place, or are the operations happening to a
different file?

If a different file, put the VBA code in the Workbook.Close event.

If the same file, post back and either myself or someone else can
help you design code that will run after your workbook has finished
exiting.


Basically, I need to put VBA code in Workbook.Close() that
deletes a file on the C: drive named "orders.txt". Then I need
to create a new replacement file named "orders.txt" which I
will write my own data into.



There are different tools available for doing this in VBA. I'm not at
all familiar with the FileSystem Object, but I did use the BASIC
statements such as OPEN, KILL, etc. years ago; and they are still
available in VBA.

Check the Visual Basic Language Reference in your on-board help for
syntax.

I don't have sample code at hand, but could throw together some air code
if you need it.

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


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 can I batch convert 97-2003 .xls files to 2007 .xlsx files Dave Nuttall Excel Discussion (Misc queries) 4 August 3rd 09 11:38 PM
Batch Files nickysquawkes[_4_] Excel Programming 6 March 2nd 06 08:13 PM
Batch conversion of XP files to 97 files AG Excel Discussion (Misc queries) 2 October 2nd 05 02:08 PM
Batch Files Mitch[_2_] Excel Programming 4 October 4th 03 04:40 PM
Batch files and VBA daver676 Excel Programming 2 September 17th 03 06:57 PM


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