Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamically creating a toolbar button
Hello,
I am trying to create a toolbar button, paste an icon on it, and assign it a macro -- all at run time. Here is what I tried. Insert-Picture-From File: ~/Desktop/whatever.bmp Tools-Macro-Record New Macro: OK. Selected the foo.bmp image with the mouse Hit Ctrl-c to copy the image to the clipboard On the toolbar, right-clicked, -Customize In the Categories field, selected Macros From the Commands field, dragged the Custom Button with smiley to the toolbar Selected the new button on the toolbar Clicked Modify Selection Changed the name to "&Show All Names" Clicked Paste Button Image Clicked Assign A Macro: Selected my Show_All_Names macro Tools-Macro-Stop Recording Here is the code it recorded, without comments: Sub Macro1() ActiveSheet.Shapes("Picture 1").Select Selection.Copy Application.CommandBars("Standard").Controls.Add Type:=msoControlButton, ID _ :=2950, Befo=31 End Sub If I run Macro1() again, a new button is created, but no macro is assigned, and the button shows a smiley face, not whatever.bmp. Clearly those steps weren't recorded. And though I've searched through the Object Browser, I haven't found a way to do it. Can anyone out there think of a way to do this? Can I programmatically manipulate the drop-down menus? If I have to manipulate keystrokes, I will. Thanks in advance, Gregory Kip Sorry about the false email address. I dislike spam. Please respond to the newsgroup. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamically creating a toolbar button
That should be:
"Selected the whatever.bmp image with the mouse." |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Issue with the Camera Button for creating dynamically updating pic | Excel Discussion (Misc queries) | |||
Repetive Formatting/Creating a Toolbar button | Excel Discussion (Misc queries) | |||
Creating a macro that simulates some of the toolbar button | New Users to Excel | |||
Creating a button on Excel Toolbar | Excel Programming |