Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

assigning a macro to a button from within a macro

Posted on 1998-06-30
1
Medium Priority
?
575 Views
Last Modified: 2008-02-01
I have a macro that creates a custom button on the toolbar. I want it to be automatically assigned to another macro.  Here's the code:

Dim msoButton As CommandBarButton

Set msoButton=Application.CommandBars("standard").Controls.
Add(msoControlButton, 2950, , 4)
   
I tried:

msoButton.OnAction = call print_claim
msoButton.Execute = print_claim
etc
etc

Nothing works.  Please help?    
0
Comment
Question by:leekk
1 Comment
 
LVL 3

Accepted Solution

by:
shalbe earned 400 total points
ID: 1612651
leekk,

This example adds a command bar control to the command bar named "Custom" and sets the macro named "MySub" to run whenever the button is clicked.

Set myBar = .CommandBars("Custom")
Set myControl = myBar.Controls _
    .Add(Type:=msocontrolButton)
With myControl
    .FaceId = 2
    .OnAction = "MySub"
End With
myBar.Visible = True


looks like for your macro the syntax should be:

           msoButton.OnAction = "print_claim"

that should do the trick for you. If not, let me know what happens.

Steve
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
New style of hardware planning for Microsoft Exchange server.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question