Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Customizing commandbar problems

I am trying to customize the shapes commandbar on a
worksheet activation and continually get an error when I
attempt to delete the format object... item from the menu.

"Invalid procedure call or argument"

This is a one time error message and then it seems to
disappear any other times I access the worksheet while the
workbook is open.

Does anyone have any insight into this as it is becoming
very frustrating.

David

Private Sub Worksheet_Activate()
Application.CommandBars("Shapes").Reset
Application.CommandBars("Shapes").Enabled = True
Application.OnKey "^x", "CompDelete"
Application.OnKey "{delete}", "CompDelete"
Application.OnKey "{insert}", "CompInsert"
With Application.CommandBars("Shapes")
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Insert Picture"
.Controls("Insert Picture").OnAction = "CompInsert"
.Controls("Insert Picture").FaceId = 295
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Delete Picture"
.Controls("Delete Picture").OnAction = "CompDelete"
.Controls("Delete Picture").FaceId = 292
.Controls("Format Object...").Delete
.Controls("Cut").Delete
.Controls("Paste").Delete
.Controls("Copy").Delete
.Controls("Grouping").Delete
.Controls("Order").Delete
.Controls("Assign Macro...").Delete
.Controls("Set Autoshape Defaults").Delete
.Controls("Hyperlink...").Delete
End With

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Customizing commandbar problems

David,

"Format Object" does not appear on the Shapes Command Bar.
It can appear on the "Button", "Object /Plot" command bars depending on your Excel version.

Regards,
Jim Cone
San Francisco, CA

"David Cuthill" wrote in message ...
I am trying to customize the shapes commandbar on a
worksheet activation and continually get an error when I
attempt to delete the format object... item from the menu.
"Invalid procedure call or argument"
This is a one time error message and then it seems to
disappear any other times I access the worksheet while the
workbook is open.
Does anyone have any insight into this as it is becoming
very frustrating.
David
Private Sub Worksheet_Activate()
Application.CommandBars("Shapes").Reset
Application.CommandBars("Shapes").Enabled = True
Application.OnKey "^x", "CompDelete"
Application.OnKey "{delete}", "CompDelete"
Application.OnKey "{insert}", "CompInsert"
With Application.CommandBars("Shapes")
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Insert Picture"
.Controls("Insert Picture").OnAction = "CompInsert"
.Controls("Insert Picture").FaceId = 295
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Delete Picture"
.Controls("Delete Picture").OnAction = "CompDelete"
.Controls("Delete Picture").FaceId = 292
.Controls("Format Object...").Delete
.Controls("Cut").Delete
.Controls("Paste").Delete
.Controls("Copy").Delete
.Controls("Grouping").Delete
.Controls("Order").Delete
.Controls("Assign Macro...").Delete
.Controls("Set Autoshape Defaults").Delete
.Controls("Hyperlink...").Delete
End With
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Customizing commandbar problems

That's weird since it shows up on the same bar as all the
other things I'm trying to delete. Is it possible to have
multiple bars open since the shape is a
groupobject/drawingobject?

I'll try also closing the object command bar.

David
-----Original Message-----
David,

"Format Object" does not appear on the Shapes Command Bar.
It can appear on the "Button", "Object /Plot" command

bars depending on your Excel version.

Regards,
Jim Cone
San Francisco, CA

"David Cuthill"

wrote in message news:473e01c47355$c4ccff80
...
I am trying to customize the shapes commandbar on a
worksheet activation and continually get an error when

I
attempt to delete the format object... item from the

menu.
"Invalid procedure call or argument"
This is a one time error message and then it seems to
disappear any other times I access the worksheet while

the
workbook is open.
Does anyone have any insight into this as it is

becoming
very frustrating.
David
Private Sub Worksheet_Activate()
Application.CommandBars("Shapes").Reset
Application.CommandBars("Shapes").Enabled = True
Application.OnKey "^x", "CompDelete"
Application.OnKey "{delete}", "CompDelete"
Application.OnKey "{insert}", "CompInsert"
With Application.CommandBars("Shapes")
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Insert Picture"
.Controls("Insert Picture").OnAction = "CompInsert"
.Controls("Insert Picture").FaceId = 295
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Delete Picture"
.Controls("Delete Picture").OnAction = "CompDelete"
.Controls("Delete Picture").FaceId = 292
.Controls("Format Object...").Delete
.Controls("Cut").Delete
.Controls("Paste").Delete
.Controls("Copy").Delete
.Controls("Grouping").Delete
.Controls("Order").Delete
.Controls("Assign Macro...").Delete
.Controls("Set Autoshape Defaults").Delete
.Controls("Hyperlink...").Delete
End With
End Sub

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Customizing commandbar problems

David,

The Shapes command bar is a "shortcut" bar that pops up when you right-click a shape?

The XL97 "Shapes" (70) command bar contains:
Cu&t &Copy &Paste Edit Te&xt &Grouping O&rder Assig&n Macro...
Set AutoShape &Defaults &Object... &Hyperlink
I show 44 different shortcut bars in XL 97

The XL2002 "Shapes" (92) command bar contains:
Cu&t &Copy &Paste Recon&vert Edit Te&xt &Grouping O&rder Assig&n Macro...
Set AutoShape &Defaults &Object... &Hyperlink... Edit &Hyperlink...
&Open Hyperlink &Remove Hyperlink
I show 60 different shortcut bars in XL 2002.

Regards,
Jim Cone
San Francisco, CA

"David Cuthill" wrote in message ...
That's weird since it shows up on the same bar as all the
other things I'm trying to delete. Is it possible to have
multiple bars open since the shape is a
groupobject/drawingobject?
I'll try also closing the object command bar.
David


-----Original Message-----
David,
"Format Object" does not appear on the Shapes Command Bar.
It can appear on the "Button", "Object /Plot" command

bars depending on your Excel version.
Regards,
Jim Cone
San Francisco, CA


- snip -
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Customizing commandbar problems

David,

In addition to Jim's comment, I suggest you try running
the below CheckSpelling macro. You'll be in for a surprise.

I rewrote your macro using a loop to delete the controls
instead. Make sure that the macros CompInsert and
CompDelete are in a standard code module instead of the
worksheet code module.

Sub CheckSpelling()
Dim CB As CommandBar
Dim Ctrl As CommandBarControl
Set CB = Application.CommandBars("Shapes")
For Each Ctrl In CB.Controls
MsgBox Ctrl.Caption
Next
End Sub

Private Sub Worksheet_Activate()
Dim CB As CommandBar
Dim Ctrl As CommandBarControl
With Application
.OnKey "^x", "CompDelete"
.OnKey "{DELETE}", "CompDelete"
.OnKey "{INSERT}", "CompInsert"
Set CB = .CommandBars("Shapes")
End With

For Each Ctrl In CB.Controls
Ctrl.Delete
Next
Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
With Ctrl
.Caption = "Insert Picture"
.OnAction = "CompInsert"
.FaceId = 295
End With
Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
With Ctrl
.Caption = "Delete Picture"
.OnAction = "CompDelete"
.FaceId = 292
End With
End Sub

Regards,
Greg

-----Original Message-----
That's weird since it shows up on the same bar as all the
other things I'm trying to delete. Is it possible to have
multiple bars open since the shape is a
groupobject/drawingobject?

I'll try also closing the object command bar.

David
-----Original Message-----
David,

"Format Object" does not appear on the Shapes Command

Bar.
It can appear on the "Button", "Object /Plot" command

bars depending on your Excel version.

Regards,
Jim Cone
San Francisco, CA

"David Cuthill"

wrote in message news:473e01c47355$c4ccff80
...
I am trying to customize the shapes commandbar on a
worksheet activation and continually get an error when

I
attempt to delete the format object... item from the

menu.
"Invalid procedure call or argument"
This is a one time error message and then it seems to
disappear any other times I access the worksheet while

the
workbook is open.
Does anyone have any insight into this as it is

becoming
very frustrating.
David
Private Sub Worksheet_Activate()
Application.CommandBars("Shapes").Reset
Application.CommandBars("Shapes").Enabled = True
Application.OnKey "^x", "CompDelete"
Application.OnKey "{delete}", "CompDelete"
Application.OnKey "{insert}", "CompInsert"
With Application.CommandBars("Shapes")
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Insert Picture"
.Controls("Insert Picture").OnAction = "CompInsert"
.Controls("Insert Picture").FaceId = 295
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Delete Picture"
.Controls("Delete Picture").OnAction = "CompDelete"
.Controls("Delete Picture").FaceId = 292
.Controls("Format Object...").Delete
.Controls("Cut").Delete
.Controls("Paste").Delete
.Controls("Copy").Delete
.Controls("Grouping").Delete
.Controls("Order").Delete
.Controls("Assign Macro...").Delete
.Controls("Set Autoshape Defaults").Delete
.Controls("Hyperlink...").Delete
End With
End Sub

.

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Customizing commandbar problems

Thanks Jim and Greg everything now works as hoped. The
checkspelling macro is very useful.


David



-----Original Message-----
David,

In addition to Jim's comment, I suggest you try running
the below CheckSpelling macro. You'll be in for a

surprise.

I rewrote your macro using a loop to delete the controls
instead. Make sure that the macros CompInsert and
CompDelete are in a standard code module instead of the
worksheet code module.

Sub CheckSpelling()
Dim CB As CommandBar
Dim Ctrl As CommandBarControl
Set CB = Application.CommandBars("Shapes")
For Each Ctrl In CB.Controls
MsgBox Ctrl.Caption
Next
End Sub

Private Sub Worksheet_Activate()
Dim CB As CommandBar
Dim Ctrl As CommandBarControl
With Application
.OnKey "^x", "CompDelete"
.OnKey "{DELETE}", "CompDelete"
.OnKey "{INSERT}", "CompInsert"
Set CB = .CommandBars("Shapes")
End With

For Each Ctrl In CB.Controls
Ctrl.Delete
Next
Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
With Ctrl
.Caption = "Insert Picture"
.OnAction = "CompInsert"
.FaceId = 295
End With
Set Ctrl = CB.Controls.Add(Type:=msoControlButton)
With Ctrl
.Caption = "Delete Picture"
.OnAction = "CompDelete"
.FaceId = 292
End With
End Sub

Regards,
Greg

-----Original Message-----
That's weird since it shows up on the same bar as all

the
other things I'm trying to delete. Is it possible to

have
multiple bars open since the shape is a
groupobject/drawingobject?

I'll try also closing the object command bar.

David
-----Original Message-----
David,

"Format Object" does not appear on the Shapes Command

Bar.
It can appear on the "Button", "Object /Plot" command

bars depending on your Excel version.

Regards,
Jim Cone
San Francisco, CA

"David Cuthill"

wrote in message news:473e01c47355$c4ccff80
...
I am trying to customize the shapes commandbar on a
worksheet activation and continually get an error

when
I
attempt to delete the format object... item from the

menu.
"Invalid procedure call or argument"
This is a one time error message and then it seems to
disappear any other times I access the worksheet

while
the
workbook is open.
Does anyone have any insight into this as it is

becoming
very frustrating.
David
Private Sub Worksheet_Activate()
Application.CommandBars("Shapes").Reset
Application.CommandBars("Shapes").Enabled = True
Application.OnKey "^x", "CompDelete"
Application.OnKey "{delete}", "CompDelete"
Application.OnKey "{insert}", "CompInsert"
With Application.CommandBars("Shapes")
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Insert Picture"
.Controls("Insert Picture").OnAction

= "CompInsert"
.Controls("Insert Picture").FaceId = 295
.Controls.Add(Type:=msoControlButton,
Befo=1).Caption = "Delete Picture"
.Controls("Delete Picture").OnAction

= "CompDelete"
.Controls("Delete Picture").FaceId = 292
.Controls("Format Object...").Delete
.Controls("Cut").Delete
.Controls("Paste").Delete
.Controls("Copy").Delete
.Controls("Grouping").Delete
.Controls("Order").Delete
.Controls("Assign Macro...").Delete
.Controls("Set Autoshape Defaults").Delete
.Controls("Hyperlink...").Delete
End With
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
commandbar problems Richard Cook Excel Discussion (Misc queries) 1 July 8th 05 05:32 PM
Add-In needs to create CommandBar lucp Excel Programming 8 June 27th 04 01:46 PM
commandbar Greg Prost[_2_] Excel Programming 2 November 21st 03 11:42 AM
commandbar hunt defj Excel Programming 2 November 17th 03 11:40 PM
Moving CommandBar using VBA or C# Aaron Queenan Excel Programming 1 October 31st 03 03:20 PM


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