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 ? |
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 ? |
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 ? |
Call particular Excel function from command line
|
All times are GMT +1. The time now is 06:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com