Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Assigning Macro by using code

Sub AddMenuIcon()

With Application.CommandBars("Standard").Controls.Add( _
Type:=msoControlButton, _
ID:=2950, Befo=9)
.OnAction = "myMacro"
End With
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Richard" wrote in message
...
Hello,

This is second time that I'm posting it.

Hope someone can help me with this.

I want to assign a macro( Userform1.show) to icon that I add in for
command
bar.

I use the below code to add smiley icon on command bar and I want to use
code to assign a macro.

Sub AddMenuIcon()

Application.CommandBars("Standard").Controls.Add
Type:=msoControlButton,
ID _
:=2950, Befo=9

???????? <<== Here I want to code to assign macro so that if user click
this amiley button, the userform can be poped up.

End Sub

Any help will be appreciated.

Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Assigning Macro by using code

Existed where? already used on another button, or the image exists
somewhere? The former would be very difficult if not impossible unless you
knew all controls that might use it, the latter is simple if you know the
sheet and the image name.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Richard" wrote in message
...
Bob,

It works perfect; however, I have one more question.

Before I create Smiley face icon, I want to chack if the Smiley face is
already existed or not. If the Smiley face already existed, then I just

want
to assign the macro; otherwise, add Smiley face before assign the macro.

Can you help me with this as well, please?

Thank you so much.

"Bob Phillips" wrote:

Sub AddMenuIcon()

With Application.CommandBars("Standard").Controls.Add( _
Type:=msoControlButton, _
ID:=2950, Befo=9)
.OnAction = "myMacro"
End With
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Richard" wrote in message
...
Hello,

This is second time that I'm posting it.

Hope someone can help me with this.

I want to assign a macro( Userform1.show) to icon that I add in for
command
bar.

I use the below code to add smiley icon on command bar and I want to

use
code to assign a macro.

Sub AddMenuIcon()

Application.CommandBars("Standard").Controls.Add
Type:=msoControlButton,
ID _
:=2950, Befo=9

???????? <<== Here I want to code to assign macro so that if user

click
this amiley button, the userform can be poped up.

End Sub

Any help will be appreciated.

Thanks






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
Finding a single word match in a text string and assigning a code Morton Detwyler[_2_] Excel Worksheet Functions 6 September 15th 09 09:18 PM
Urgent - Pl help code for assigning a shape to cells Sarah Excel Programming 2 September 27th 04 09:53 PM
Creating Buttons and assigning code winshent Excel Programming 3 July 14th 04 09:14 AM
Assigning VBA code to a Toolbar Bonnie[_5_] Excel Programming 2 November 11th 03 06:23 PM
Assigning Selected Cells to Code JMay Excel Programming 4 July 19th 03 05:29 PM


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

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"