Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call particular Excel function from command line
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 ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 ? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call particular Excel function from command line
Hi and Thanks for your great help !
Can you please let me know what the code should look like if I want to pass in some parameters into that Macro function as well ?? Thanks ! sqlfan13 のメッセージ: 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 ? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call particular Excel function from command line
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What are the possible command-line arguments in Excel? | Excel Discussion (Misc queries) | |||
Call up build in excel command using macro | Excel Programming | |||
Excel command line | Excel Programming | |||
Call vs. Run command | Excel Programming | |||
call excel 2003 macro from command line | Excel Programming |