ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   oh difficult... (https://www.excelbanter.com/excel-programming/408685-oh-difficult.html)

x [email protected]

oh difficult...
 
Dim grp As GroupBox
Set grp = s.GroupBoxes.Add(3.75, 62.25, 242, 47)
grp.Caption = "xxx"
set s=activesheet
s.Shapes.Range(Array(grp.Name, "btnAll","btnLast")).Select
Selection.ShapeRange.Group.Select
Selection.Name = "myGroup"

and btnAll and btnLast is linked with OnAction method to the following
procedure..

sub sbBtn()
dim btn as button
set btn=activesheet.buttons(application.caller)'...err or
if btn.name="btnAll" then
msgbox 1
elseif btn.name="btnLast" then
msgbox 2
end if
end sub

why??? about button in group box.......

*** Sent via Developersdex http://www.developersdex.com ***

Dave Peterson

oh difficult...
 
I'm not sure what you're doing, but don't group the shapes.

Isn't it enough that the objects are within the groupbox?

"x " wrote:

Dim grp As GroupBox
Set grp = s.GroupBoxes.Add(3.75, 62.25, 242, 47)
grp.Caption = "xxx"
set s=activesheet
s.Shapes.Range(Array(grp.Name, "btnAll","btnLast")).Select
Selection.ShapeRange.Group.Select
Selection.Name = "myGroup"

and btnAll and btnLast is linked with OnAction method to the following
procedure..

sub sbBtn()
dim btn as button
set btn=activesheet.buttons(application.caller)'...err or
if btn.name="btnAll" then
msgbox 1
elseif btn.name="btnLast" then
msgbox 2
end if
end sub

why??? about button in group box.......

*** Sent via Developersdex
http://www.developersdex.com ***

--

Dave Peterson

x [email protected]

oh difficult...
 
Dim grp As GroupBox
set s=activesheet
Set grp = s.GroupBoxes.Add(3.75, 62.25, 242, 47)
grp.Caption = "xxx"
s.Shapes.Range(Array(grp.Name, "btnAll","btnLast")).Select
Selection.ShapeRange.Group.Select
Selection.Name = "myGroup"

sub sbBtn()
dim btn as button
set btn=activesheet.buttons(application.caller)'...err or
if btn.name="btnAll" then
msgbox 1
elseif btn.name="btnLast" then
msgbox 2
end if
end sub



I make 2 buttons(controlformat type) in a sheet. and the buttons of
controlformat have a procedure(sbBtn). and I make a groupbox of
controformat in a sheet. The 2 buttons is included in the groupbox. and
then the buttons and groupbox is grouped, and the group is named
'myGroup'.

I want to do specific action when I click a button.
Namely, when btnAll is clicked, msgbox 1...
only one procedure is acted.




*** Sent via Developersdex http://www.developersdex.com ***

Dave Peterson

oh difficult...
 
My suggestion is still not to group the shapes.

You haven't shared a reason to group the shapes.

"x " wrote:

Dim grp As GroupBox
set s=activesheet
Set grp = s.GroupBoxes.Add(3.75, 62.25, 242, 47)
grp.Caption = "xxx"
s.Shapes.Range(Array(grp.Name, "btnAll","btnLast")).Select
Selection.ShapeRange.Group.Select
Selection.Name = "myGroup"

sub sbBtn()
dim btn as button
set btn=activesheet.buttons(application.caller)'...err or
if btn.name="btnAll" then
msgbox 1
elseif btn.name="btnLast" then
msgbox 2
end if
end sub

I make 2 buttons(controlformat type) in a sheet. and the buttons of
controlformat have a procedure(sbBtn). and I make a groupbox of
controformat in a sheet. The 2 buttons is included in the groupbox. and
then the buttons and groupbox is grouped, and the group is named
'myGroup'.

I want to do specific action when I click a button.
Namely, when btnAll is clicked, msgbox 1...
only one procedure is acted.

*** Sent via Developersdex
http://www.developersdex.com ***

--

Dave Peterson


All times are GMT +1. The time now is 04:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com