Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I pass an argument from cmd.exe to an Excel macro?
I tested with VB6 using the below sample & successfully passed Arg1 & Arg2 over to Macro1. But how to do this if I start from cmd.exe instead of VB6? '====================== ' The code in VB6 '====================== Sub Command3_Click() Dim XL As Object Dim Ans As String Set XL = CreateObject("Excel.Application") With XL .Workbooks.Open "C:\TheFileContainingMacro1.xls" Ans = .Run("Macro1", "Value_Of_Arg1", "Value_Of_Arg2") .Quit End With Set XL = Nothing End End Sub '====================== ' The code in "C:\TheFileContainingMacro1.xls!Macro1 '====================== Function Macro1(FromExternal_1, FromExternal_Arg2) With ActiveSheet .Range("A1") = FromExternal_1 .Range("A2") = FromExternal_2 End With ActiveWorkbook.Save End Function But how to do this if I start from cmd.exe instead of VB6? Thanks a million -- Edmund (Using Excel XP) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
passing an argument | Excel Programming | |||
Passing a UDF as an argument to a UDF | Excel Discussion (Misc queries) | |||
Passing argument to Excel | Excel Programming | |||
Passing argument to excel | Excel Programming | |||
Passing argument to another Sub | Excel Programming |