Passing Argument using ICommandItem.Execute in VBA

Discussion created by on Jun 27, 2012
Latest reply on Jun 28, 2012 by
I am working with HecGeoRas and it is a toolbar with a series of commands.  I am able to call these commands using the ICommandItem.Execute via a UID.

Sub ExecuteCmd()
  Dim pUID As New UID
  Dim pCmdItem As ICommandItem
  ' Use the GUID of the Save command
  pUID.Value = "{C3116AF1-F68C-428D-A62B-16F6E0C7A356}"
  ' Layer Setup:                              {C3116AF1-F68C-428D-A62B-16F6E0C7A356}
  ' Import Ras Data:                          {4623536F-5B32-4B65-918C-D903A1384A09}
  ' Water Surface Generation:                 {CEB072B7-A420-447C-BF16-12D3F632EDB3}
  ' Water Surface Deliniation Using Rasters:  {ED67C0C3-C9E9-4FD7-9F76-DA833781D8DB}
  ' or you can use the ProgID
  ' pUID.Value = "esriArcMapUI.MxFileMenuItem"
  pUID.SubType = 3
  Set pCmdItem = Application.Document.CommandBars.Find(pUID)
End Sub

So my question:  Is there a way to feed arguments after the "pCmdItem.Execute" command so that I can run input the required arguments for this command from code and not interactively.  I have spent hours trying to find a solution and I can't seem to find one.  Also, if there is an easier way to do this in python that would be fine.  If anyone could supply sample code to solve my issue I would appreciate it.