View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Will Anikouchine Will Anikouchine is offline
external usenet poster
 
Posts: 3
Default Programmatic button click

Thank you for your response. I have not been able to apply your suggestions. I am using Excel 2003. When I bring up the excel workbook, go to the appropriate sheet and right click on the command button (with a caption: CONVERT) nothing happens. I am not able to perform the "assign macro" action.

I am able to use VB editor to explore the macros contained in the workbook, but I cannot ascertain what the "name of the procedure assigned to the button" represents. The code for the click option of the button calls several SUBs. One is called "convert_points". I have tried to use both CONVERT and Convert
_Points in the Application.Run code that you recommended but neither work.

What am I doing wrong?



Posted as a reply to:

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