Submenus with AddCommandItem2

Hi,

I know how to create submenus using the AddCommandItem2 except when I want the first item to be a submenu. Example:

I know how to create this:

SW Add-In

-----------------

Command1

Command2 > SubCommand3

Command3 > SubCommand4

Dim cmdIndex(100) as integer

Dim cmdGroup as ICommandGroup

Dim cmdGroup2 as ICommandGroup

Dim cmdGroup3 as ICommandGroup

Dim Title as string = "SW Add-In"

cmdGroup = iCmdMgr.CreateCommandGroup2(1, Title, ToolTip, ToolTip, 5, ignorePrevious, cmdGroupErr)

cmdGroup.ShowInDocumentType = swDocTemplateTypes_e.swDocTemplateTypeASSEMBLY

cmdIndex(0) = cmdGroup.AddCommandItem2("Command1", - 1, "Command1", "Command1", 0, "ShowCommand1", 1, _

                                        0, swCommandItemType_e.swMenuItem)

cmdGroup.HasToolbar = True

cmdGroup.HasMenu = True

cmdGroup.Activate()

Title = "SW Add-In\\\\Command2"

cmdGroup2 = iCmdMgr.CreateCommandGroup2(2, Title, ToolTip, ToolTip, 5, ignorePrevious, cmdGroupErr)

cmdGroup.ShowInDocumentType = swDocTemplateTypes_e.swDocTemplateTypeASSEMBLY

cmdIndex(1) = cmdGroup.AddCommandItem2("SubCommand3", - 1, "SubCommand3", "SubCommand3", 0, "ShowSubCommand3", 1, _

                                        0, swCommandItemType_e.swMenuItem)

But I don't know to create this:

SW Add-In

-----------------

Command2 > SubCommand3

Command3 > SubCommand4

Command1

Does anyone know how?

Thanks in advance,

Eduardo Brites

SolidworksApi macros