LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Call particular Excel function from command line

You could create a simple script, similar to the following, and execute the
script from the command line.

<Code

'Define your Excel application object
Dim objXL
dim moUseSheet

Const C_APP_PATH = "C:\folder\"
Const csUseSheet = "MySpreadsheet.XLS"

'------------------------------------------
' Create an instance of Excel
'------------------------------------------
On Error Resume Next
Set objXL = GetObject(,"Excel.Application")

If TypeName(objXL) < "Application" Then
Set objXL = CreateObject("Excel.Application")
End If

On Error GoTo 0

'Open the file
Set moUseSheet = objXL.Workbooks.Open(C_APP_PATH & csUseSheet)
objXL.Visible = True

'Run Macro
objXL.Application.Run csUseSheet & "!MacroNameToRun"
'Set window size xlNormal
objXL.WindowState = -4143
moUseSheet.Close

Set moUseSheet = Nothing
Set objXL = Nothing

<End Code

Hope this gives you something to go with.


" wrote:

Anyone can teach me how I can trigger e.g. SpreadSheet A - Module B -
Function C from Windows Command Line ? Is there such an
option/partameter ?


 
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
What are the possible command-line arguments in Excel? d2reason Excel Discussion (Misc queries) 2 June 4th 07 09:39 PM
Call up build in excel command using macro Will Gray Excel Programming 1 August 24th 06 03:35 AM
Excel command line Jef Gorbach Excel Programming 5 June 29th 05 04:01 AM
Call vs. Run command Chris McFarland Excel Programming 1 June 21st 04 04:10 PM
call excel 2003 macro from command line Keven[_2_] Excel Programming 1 June 2nd 04 05:33 AM


All times are GMT +1. The time now is 11:54 AM.

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"