Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run Excel Macro in a Batch File

Hello,

I need to do the following in a batch process, in a DOS batch file (under
Win2000):

1. Look into the certain folder, there is always one Excel file (with
arbitrary names).
2. Open that file with Excel.
3. Run a certain macro, say Macro1, on that file.
4. Close Excel

How should I properly approach that?

Thanks in advance,
DP


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Run Excel Macro in a Batch File

Hello
Would a VB script suit you?
If it does, open a new text document and paste and amend accordingly the
following example:
Dim objXL
Set objXL = WScript.CreateObject("Excel.Application")
objXL.Visible = TRUE
objXL.WorkBooks.Open("C:\Test\YourWorkbk.xls")
objXL.run("Macro1")
'Do some other stuff
Set objXL = Nothing

Save the file with the .VBS extension and double-click to run

HTH
Cordially
Pascal


"DP" a écrit dans le message de
rs.com...
Hello,

I need to do the following in a batch process, in a DOS batch file (under
Win2000):

1. Look into the certain folder, there is always one Excel file (with
arbitrary names).
2. Open that file with Excel.
3. Run a certain macro, say Macro1, on that file.
4. Close Excel

How should I properly approach that?

Thanks in advance,
DP




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Loop through all the lines in a sheet (Was: Run Excel Macro in a Batch File)

Hello,

Thank you very much! I will try that.
And now, if you pardon my ignorance, let me ask you that silly question:

How I can iterate in a macro through all the lines of an Excel file?
Strangely, I couldn't find help on that in Excel help. Where that and
similar question about the essential macro commands could be answered?

Thank you,
DP



"papou" wrote in message
...
Hello
Would a VB script suit you?
If it does, open a new text document and paste and amend accordingly the
following example:
Dim objXL
Set objXL = WScript.CreateObject("Excel.Application")
objXL.Visible = TRUE
objXL.WorkBooks.Open("C:\Test\YourWorkbk.xls")
objXL.run("Macro1")
'Do some other stuff
Set objXL = Nothing

Save the file with the .VBS extension and double-click to run

HTH
Cordially
Pascal


"DP" a écrit dans le message de
rs.com...
Hello,

I need to do the following in a batch process, in a DOS batch file (under
Win2000):

1. Look into the certain folder, there is always one Excel file (with
arbitrary names).
2. Open that file with Excel.
3. Run a certain macro, say Macro1, on that file.
4. Close Excel

How should I properly approach that?

Thanks in advance,
DP






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
Batch file initiation from Excel macro? Yarroll Excel Discussion (Misc queries) 1 October 13th 06 02:50 PM
Call a batch file from an Excel Macro Alex Horan Excel Discussion (Misc queries) 0 March 2nd 06 03:29 PM
Call a batch file from an Excel Macro Gary''s Student Excel Discussion (Misc queries) 0 March 2nd 06 03:26 PM
Create a batch file from a number of Excel File Vinay[_2_] Excel Programming 0 September 8th 04 01:11 AM
Macro to activate a Batch file ! Tarek[_2_] Excel Programming 3 October 13th 03 08:02 PM


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