![]() |
commandline argument in excel 2003
I want to pass command line argument to to the VBA code in EXCEL 2003. I
cannot use Command() or COmmand$(). Kindly suggest how should i go about it? Thanks |
commandline argument in excel 2003
From "Microsoft Visual Basic Help":
"The Visual Basic Command function is not available in Microsoft Office applications." So forget about the command() function. You might have to consider using Office Automation. If you are familar with visual basic you can do automation with Windows Scripting Host: - create a Windows Scripting Host file that creates an excel application object. - call the run method on the object passing the macro name that you want to execute + command line arguments Something like this: ' --------------------------- ' automate.vbs ' --------------------------- Dim app, wb, args Set args = WScript.Arguments Set app = CreateObject("Excel.Application") Set wb = app.Workbooks.Open("c:\myfile.xls") app.Run "Module1.MyMacro", args(0) wb.Close app.Quit Set wb = Nothing Set excel = Nothing ' --------------------------- Try calling automate.vbs from command line prompt, e.g. c:\ automate.vbs param1 param2 Hope this helps -- arunkhemlai "gonnyv" wrote: I want to pass command line argument to to the VBA code in EXCEL 2003. I cannot use Command() or COmmand$(). Kindly suggest how should i go about it? Thanks |
commandline argument in excel 2003
Hi gonnyv,
Look : http://www.google.fr/groups?hl=fr&lr...5a7f0&s eekm= Od3YRGRDFHA.1296%40TK2MSFTNGP10.phx.gbl#link4 MP "gonnyv" a écrit dans le message de news: ... I want to pass command line argument to to the VBA code in EXCEL 2003. I cannot use Command() or COmmand$(). Kindly suggest how should i go about it? Thanks |
All times are GMT +1. The time now is 07:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com