Menu and Form problems

M

moonhk

In menu, can able to Pass parameter using "OnAction" ?

Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlButton)
With MenuItem
.Caption = "Build Japan"
.FaceId = 0
.OnAction = "Process_frm_GEN (\""JAP\"")" <--- This coding not
works
.BeginGroup = True '~~ Separators in menu
End With


Sub Process_frm_GEN(loSite As String)
MsgBox loSite
End Sub


Also, it is possible pass parameters to form ? I want change Form
Caption and some value.

Sub Process_frm_SIN()
frmProcess_SIN.Show
End Sub
 
B

Bob Phillips

Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlButton)
With MenuItem
.Caption = "Build Japan"
.FaceId = 0
.OnAction = "Process_frm_GEN
.Parameter = "JAP"
.BeginGroup = True '~~ Separators in menu
End With


Sub Process_frm_GEN()
With Application.Commandbars.ActionControl
MsgBox .Parameter
End With
End Sub

Also, it is possible pass parameters to form ? I want change Form
Caption and some value.

Sub Process_frm_SIN()
frmProcess_SIN.Caption = "Test"
frmProcess_SIN.Show
End Sub


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
M

moonhk

It works.

Bob said:
Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlButton)
With MenuItem
.Caption = "Build Japan"
.FaceId = 0
.OnAction = "Process_frm_GEN
.Parameter = "JAP"
.BeginGroup = True '~~ Separators in menu
End With


Sub Process_frm_GEN()
With Application.Commandbars.ActionControl
MsgBox .Parameter
End With
End Sub



Sub Process_frm_SIN()
frmProcess_SIN.Caption = "Test"
frmProcess_SIN.Show
End Sub


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top