View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Will Anikouchine Will Anikouchine is offline
external usenet poster
 
Posts: 3
Default Programmatic click of button from a different macro

Hello,

Thanks for your response.
How can I determine the "procedure assigned to my button"? Is this the name of the SUB called when the button is pressed manually or has Excel assigned a name for my button that is hidden?

Will A.



Chip Pearson wrote:

VBA code to send click command to a macro in a different Excel workbook
19-Sep-09

A Sub procedure can be assigned to a shape or button, either
programmatically (via code) or by right-clicking the shape and
choosing "Assign Macro". If you know the name of the procedure
assigned to the shape or button, you can call that procedure directly,
by-passing the shape entirely. If you don't know the name of the
procedure, right-click the shape and choose "Assign Macro" and the
assigned macro name will be displayed. Once you know that, just use in
your code something like:

Sub ABC()
' your code
Application.Run "TheProcName"
' more code
End Sub

where "TheProcName" is the procedure assigned to your shape or button.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Sat, 19 Sep 2009 17:03:35 -0700, Will Anikouchine wrote:

EggHeadCafe - Software Developer Portal of Choice
WPF And The Model View View Model Pattern
http://www.eggheadcafe.com/tutorials...l-view-vi.aspx