Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Custom Floatable Toolbar Popup Menu

I know how to make custom toolbars in Excel and through VBA. Is it possible
to make popup menus within a toolbar that are floatable (similar to the font
and cell color pallettes)?

Thanks,
Pflugs
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Custom Floatable Toolbar Popup Menu

Just for ideas -

Sub CustomBar()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
Application.CommandBars("TestBar").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("TestBar")

Set cbt = cbr.Controls.Add(1)

With cbt
.Style = msoButtonCaption
.Caption = "click for Pop-up"
.Visible = True
.OnAction = "myPopup"
End With

cbr.Position = msoBarFloating
cbr.Visible = True

End Sub

Sub myPopup()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
CommandBars("myPopup").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("myPopup", msoBarPopup, , True)

For i = 80 To 89
Set cbt = cbr.Controls.Add(1, , , , True)
With cbt
.Style = msoButtonIconAndCaption
.Caption = "code " & Chr(i - 15)
.FaceId = i
.Parameter = i - 79
.Visible = True
.OnAction = "myMacro"
End With
Next
On Error GoTo errH

cbr.ShowPopup

done:
cbr.Delete
Exit Sub
errH:
Resume done
End Sub

Sub MyMacro()
Dim cbt As CommandBarButton
Dim sParam As String

Set cbt = Application.CommandBars.ActionControl
sParam = cbt.Parameter
MsgBox "button " & sParam, , cbt.Caption

Select Case sParam
Case "1"
MsgBox "processing code " & sParam
'etc
End Select
End Sub

Regards,
Peter T


"Pflugs" wrote in message
...
I know how to make custom toolbars in Excel and through VBA. Is it

possible
to make popup menus within a toolbar that are floatable (similar to the

font
and cell color pallettes)?

Thanks,
Pflugs



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Custom Floatable Toolbar Popup Menu

Should include 'OnError Resume Next' just after 'done:'

On Error GoTo errH

cbr.ShowPopup

done:


OnError Resume Next ' add this line

cbr.Delete
Exit Sub
errH:
Resume done
End Sub



Peter T


On Error Resume Next
cbr.ShowPopup

"Peter T" <peter_t@discussions wrote in message
...
Just for ideas -

Sub CustomBar()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
Application.CommandBars("TestBar").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("TestBar")

Set cbt = cbr.Controls.Add(1)

With cbt
.Style = msoButtonCaption
.Caption = "click for Pop-up"
.Visible = True
.OnAction = "myPopup"
End With

cbr.Position = msoBarFloating
cbr.Visible = True

End Sub

Sub myPopup()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
CommandBars("myPopup").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("myPopup", msoBarPopup, , True)

For i = 80 To 89
Set cbt = cbr.Controls.Add(1, , , , True)
With cbt
.Style = msoButtonIconAndCaption
.Caption = "code " & Chr(i - 15)
.FaceId = i
.Parameter = i - 79
.Visible = True
.OnAction = "myMacro"
End With
Next
On Error GoTo errH

cbr.ShowPopup

done:
cbr.Delete
Exit Sub
errH:
Resume done
End Sub

Sub MyMacro()
Dim cbt As CommandBarButton
Dim sParam As String

Set cbt = Application.CommandBars.ActionControl
sParam = cbt.Parameter
MsgBox "button " & sParam, , cbt.Caption

Select Case sParam
Case "1"
MsgBox "processing code " & sParam
'etc
End Select
End Sub

Regards,
Peter T


"Pflugs" wrote in message
...
I know how to make custom toolbars in Excel and through VBA. Is it

possible
to make popup menus within a toolbar that are floatable (similar to the

font
and cell color pallettes)?

Thanks,
Pflugs





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Custom Floatable Toolbar Popup Menu

That's really neat and definitely useful. Any idea on how to make that popup
menu moveable and remain on the screen when you click away?

"Peter T" wrote:

Should include 'OnError Resume Next' just after 'done:'

On Error GoTo errH

cbr.ShowPopup

done:


OnError Resume Next ' add this line

cbr.Delete
Exit Sub
errH:
Resume done
End Sub



Peter T


On Error Resume Next
cbr.ShowPopup

"Peter T" <peter_t@discussions wrote in message
...
Just for ideas -

Sub CustomBar()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
Application.CommandBars("TestBar").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("TestBar")

Set cbt = cbr.Controls.Add(1)

With cbt
.Style = msoButtonCaption
.Caption = "click for Pop-up"
.Visible = True
.OnAction = "myPopup"
End With

cbr.Position = msoBarFloating
cbr.Visible = True

End Sub

Sub myPopup()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
CommandBars("myPopup").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("myPopup", msoBarPopup, , True)

For i = 80 To 89
Set cbt = cbr.Controls.Add(1, , , , True)
With cbt
.Style = msoButtonIconAndCaption
.Caption = "code " & Chr(i - 15)
.FaceId = i
.Parameter = i - 79
.Visible = True
.OnAction = "myMacro"
End With
Next
On Error GoTo errH

cbr.ShowPopup

done:
cbr.Delete
Exit Sub
errH:
Resume done
End Sub

Sub MyMacro()
Dim cbt As CommandBarButton
Dim sParam As String

Set cbt = Application.CommandBars.ActionControl
sParam = cbt.Parameter
MsgBox "button " & sParam, , cbt.Caption

Select Case sParam
Case "1"
MsgBox "processing code " & sParam
'etc
End Select
End Sub

Regards,
Peter T


"Pflugs" wrote in message
...
I know how to make custom toolbars in Excel and through VBA. Is it

possible
to make popup menus within a toolbar that are floatable (similar to the

font
and cell color pallettes)?

Thanks,
Pflugs






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Custom Floatable Toolbar Popup Menu

Upon some futher testing, I found that the type of control I'm talking about
is msoControlSplitButtonPopup. I can create these as long as they have
predefined ID's. I can't figure out how to create them from scratch and add
my own controls to them. Anyone have any thoughts?

Thanks,
Pflugs

"Peter T" wrote:

Should include 'OnError Resume Next' just after 'done:'

On Error GoTo errH

cbr.ShowPopup

done:


OnError Resume Next ' add this line

cbr.Delete
Exit Sub
errH:
Resume done
End Sub



Peter T


On Error Resume Next
cbr.ShowPopup

"Peter T" <peter_t@discussions wrote in message
...
Just for ideas -

Sub CustomBar()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
Application.CommandBars("TestBar").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("TestBar")

Set cbt = cbr.Controls.Add(1)

With cbt
.Style = msoButtonCaption
.Caption = "click for Pop-up"
.Visible = True
.OnAction = "myPopup"
End With

cbr.Position = msoBarFloating
cbr.Visible = True

End Sub

Sub myPopup()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
CommandBars("myPopup").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("myPopup", msoBarPopup, , True)

For i = 80 To 89
Set cbt = cbr.Controls.Add(1, , , , True)
With cbt
.Style = msoButtonIconAndCaption
.Caption = "code " & Chr(i - 15)
.FaceId = i
.Parameter = i - 79
.Visible = True
.OnAction = "myMacro"
End With
Next
On Error GoTo errH

cbr.ShowPopup

done:
cbr.Delete
Exit Sub
errH:
Resume done
End Sub

Sub MyMacro()
Dim cbt As CommandBarButton
Dim sParam As String

Set cbt = Application.CommandBars.ActionControl
sParam = cbt.Parameter
MsgBox "button " & sParam, , cbt.Caption

Select Case sParam
Case "1"
MsgBox "processing code " & sParam
'etc
End Select
End Sub

Regards,
Peter T


"Pflugs" wrote in message
...
I know how to make custom toolbars in Excel and through VBA. Is it

possible
to make popup menus within a toolbar that are floatable (similar to the

font
and cell color pallettes)?

Thanks,
Pflugs








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Custom Floatable Toolbar Popup Menu

I don't think there's any straightforward way to create this type of
control, or indeed various others.

Depending on what you want to achieve perhaps a cascading menu system (popup
controls rather than popup bars) or even add some more 'squarish'
commandbars.

Regards,
Peter T


"Pflugs" wrote in message
...
Upon some futher testing, I found that the type of control I'm talking

about
is msoControlSplitButtonPopup. I can create these as long as they have
predefined ID's. I can't figure out how to create them from scratch and

add
my own controls to them. Anyone have any thoughts?

Thanks,
Pflugs

"Peter T" wrote:

Should include 'OnError Resume Next' just after 'done:'

On Error GoTo errH

cbr.ShowPopup

done:


OnError Resume Next ' add this line

cbr.Delete
Exit Sub
errH:
Resume done
End Sub



Peter T


On Error Resume Next
cbr.ShowPopup

"Peter T" <peter_t@discussions wrote in message
...
Just for ideas -

Sub CustomBar()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
Application.CommandBars("TestBar").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("TestBar")

Set cbt = cbr.Controls.Add(1)

With cbt
.Style = msoButtonCaption
.Caption = "click for Pop-up"
.Visible = True
.OnAction = "myPopup"
End With

cbr.Position = msoBarFloating
cbr.Visible = True

End Sub

Sub myPopup()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
CommandBars("myPopup").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("myPopup", msoBarPopup, ,

True)

For i = 80 To 89
Set cbt = cbr.Controls.Add(1, , , , True)
With cbt
.Style = msoButtonIconAndCaption
.Caption = "code " & Chr(i - 15)
.FaceId = i
.Parameter = i - 79
.Visible = True
.OnAction = "myMacro"
End With
Next
On Error GoTo errH

cbr.ShowPopup

done:
cbr.Delete
Exit Sub
errH:
Resume done
End Sub

Sub MyMacro()
Dim cbt As CommandBarButton
Dim sParam As String

Set cbt = Application.CommandBars.ActionControl
sParam = cbt.Parameter
MsgBox "button " & sParam, , cbt.Caption

Select Case sParam
Case "1"
MsgBox "processing code " & sParam
'etc
End Select
End Sub

Regards,
Peter T


"Pflugs" wrote in message
...
I know how to make custom toolbars in Excel and through VBA. Is it
possible
to make popup menus within a toolbar that are floatable (similar to

the
font
and cell color pallettes)?

Thanks,
Pflugs







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Custom Floatable Toolbar Popup Menu

Yes, I think those methods would work better. Thanks for the popup code.
Pflugs

"Peter T" wrote:

I don't think there's any straightforward way to create this type of
control, or indeed various others.

Depending on what you want to achieve perhaps a cascading menu system (popup
controls rather than popup bars) or even add some more 'squarish'
commandbars.

Regards,
Peter T


"Pflugs" wrote in message
...
Upon some futher testing, I found that the type of control I'm talking

about
is msoControlSplitButtonPopup. I can create these as long as they have
predefined ID's. I can't figure out how to create them from scratch and

add
my own controls to them. Anyone have any thoughts?

Thanks,
Pflugs

"Peter T" wrote:

Should include 'OnError Resume Next' just after 'done:'

On Error GoTo errH

cbr.ShowPopup

done:

OnError Resume Next ' add this line

cbr.Delete
Exit Sub
errH:
Resume done
End Sub


Peter T


On Error Resume Next
cbr.ShowPopup
"Peter T" <peter_t@discussions wrote in message
...
Just for ideas -

Sub CustomBar()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
Application.CommandBars("TestBar").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("TestBar")

Set cbt = cbr.Controls.Add(1)

With cbt
.Style = msoButtonCaption
.Caption = "click for Pop-up"
.Visible = True
.OnAction = "myPopup"
End With

cbr.Position = msoBarFloating
cbr.Visible = True

End Sub

Sub myPopup()
Dim cbr As CommandBar
Dim cbt As CommandBarButton
On Error Resume Next
CommandBars("myPopup").Delete
On Error GoTo 0

Set cbr = Application.CommandBars.Add("myPopup", msoBarPopup, ,

True)

For i = 80 To 89
Set cbt = cbr.Controls.Add(1, , , , True)
With cbt
.Style = msoButtonIconAndCaption
.Caption = "code " & Chr(i - 15)
.FaceId = i
.Parameter = i - 79
.Visible = True
.OnAction = "myMacro"
End With
Next
On Error GoTo errH

cbr.ShowPopup

done:
cbr.Delete
Exit Sub
errH:
Resume done
End Sub

Sub MyMacro()
Dim cbt As CommandBarButton
Dim sParam As String

Set cbt = Application.CommandBars.ActionControl
sParam = cbt.Parameter
MsgBox "button " & sParam, , cbt.Caption

Select Case sParam
Case "1"
MsgBox "processing code " & sParam
'etc
End Select
End Sub

Regards,
Peter T


"Pflugs" wrote in message
...
I know how to make custom toolbars in Excel and through VBA. Is it
possible
to make popup menus within a toolbar that are floatable (similar to

the
font
and cell color pallettes)?

Thanks,
Pflugs








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Popup Menu / Shortcut Menu Dale Fye Excel Discussion (Misc queries) 2 October 12th 07 12:57 AM
Add standard excel button to custom toolbar menu Gixxer_J_97[_2_] Excel Programming 9 December 21st 05 07:13 PM
Tooltips won't show up in custom popup menu Brian J. Matuschak Excel Programming 1 November 16th 05 09:13 PM
VBA - Disappearing custom menu and custom toolbar Peter[_50_] Excel Programming 2 December 2nd 04 06:09 PM
Adding a check mark to the custom made toolbar/menu continue...... aiyer[_59_] Excel Programming 0 September 2nd 04 12:52 AM


All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"