Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Problem with command bar

I am getting a error with the following line (full sub is below):
Set cb = c.Controls.Add(msoControlButton, 5)

setting this (msoControlButton, 5) to (msoControlButton, 1) does not result
in an error message, but the button does not seem to execute the on action
event

Any help is much appreciated. Running Excel 2007




Sub Auto_Open()

Dim c As CommandBar
Dim cb As CommandBarButton

Set c = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
c.Enabled = True
c.Visible = True

Set cb = c.Controls.Add(msoControlButton, 2)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Refresh Data"
cb.FaceId = 159
cb.OnAction = "InitializeDataInput2"

Set cb = c.Controls.Add(msoControlButton, 3)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Generate Reports"
cb.FaceId = 433
cb.OnAction = "ProcessReportSet01"

Set cb = c.Controls.Add(msoControlButton, 4)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Print Reports"
cb.FaceId = 4
cb.OnAction = "PrintSet01"

Set cb = c.Controls.Add(msoControlButton, 5)
cb.Style = msoButtonIconAndCaption
cb.Caption = "eMail Reports"
cb.FaceId = 258
cb.OnAction = "CreateAndEmailReports"

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem with command bar

The second argument applies a built-in control identified by its ID number.
The following exist
2 &Spelling...
3 &Save
4 &Print...

but there's no id:=5

Unless you want a particular built-in control, dispense with that argument
altogether or simply use 1

Regards,
Peter T


"Tom Joseph" wrote in message
...
I am getting a error with the following line (full sub is below):
Set cb = c.Controls.Add(msoControlButton, 5)

setting this (msoControlButton, 5) to (msoControlButton, 1) does not
result
in an error message, but the button does not seem to execute the on action
event

Any help is much appreciated. Running Excel 2007




Sub Auto_Open()

Dim c As CommandBar
Dim cb As CommandBarButton

Set c = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
c.Enabled = True
c.Visible = True

Set cb = c.Controls.Add(msoControlButton, 2)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Refresh Data"
cb.FaceId = 159
cb.OnAction = "InitializeDataInput2"

Set cb = c.Controls.Add(msoControlButton, 3)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Generate Reports"
cb.FaceId = 433
cb.OnAction = "ProcessReportSet01"

Set cb = c.Controls.Add(msoControlButton, 4)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Print Reports"
cb.FaceId = 4
cb.OnAction = "PrintSet01"

Set cb = c.Controls.Add(msoControlButton, 5)
cb.Style = msoButtonIconAndCaption
cb.Caption = "eMail Reports"
cb.FaceId = 258
cb.OnAction = "CreateAndEmailReports"

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Problem with command bar

Thanks, Peter. I appreciate it.

"Peter T" wrote:

The second argument applies a built-in control identified by its ID number.
The following exist
2 &Spelling...
3 &Save
4 &Print...

but there's no id:=5

Unless you want a particular built-in control, dispense with that argument
altogether or simply use 1

Regards,
Peter T


"Tom Joseph" wrote in message
...
I am getting a error with the following line (full sub is below):
Set cb = c.Controls.Add(msoControlButton, 5)

setting this (msoControlButton, 5) to (msoControlButton, 1) does not
result
in an error message, but the button does not seem to execute the on action
event

Any help is much appreciated. Running Excel 2007




Sub Auto_Open()

Dim c As CommandBar
Dim cb As CommandBarButton

Set c = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
c.Enabled = True
c.Visible = True

Set cb = c.Controls.Add(msoControlButton, 2)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Refresh Data"
cb.FaceId = 159
cb.OnAction = "InitializeDataInput2"

Set cb = c.Controls.Add(msoControlButton, 3)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Generate Reports"
cb.FaceId = 433
cb.OnAction = "ProcessReportSet01"

Set cb = c.Controls.Add(msoControlButton, 4)
cb.Style = msoButtonIconAndCaption
cb.Caption = "Print Reports"
cb.FaceId = 4
cb.OnAction = "PrintSet01"

Set cb = c.Controls.Add(msoControlButton, 5)
cb.Style = msoButtonIconAndCaption
cb.Caption = "eMail Reports"
cb.FaceId = 258
cb.OnAction = "CreateAndEmailReports"

End Sub




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
Problem with Nothing command Wesslan Excel Programming 2 April 10th 08 05:09 PM
Problem with command button name Jason[_9_] Excel Discussion (Misc queries) 10 October 19th 07 09:54 PM
Macro command problem johncouzins Excel Discussion (Misc queries) 4 July 27th 05 09:10 PM
command bar problem helpwithXL Excel Programming 0 May 23rd 05 05:50 PM
command bar problem helpwithXL Excel Programming 2 May 18th 05 06:39 PM


All times are GMT +1. The time now is 07:34 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"