Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Button to activate macro

I've written a macro and I would like to present a button when the workbook
is opened to allow user to run the macro. Can someone post an example?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Button to activate macro

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/28/2007 by jim ravenswood
'

'
Application.CommandBars("Forms").Visible = True
ActiveSheet.Buttons.Add(290.25, 69, 51.75, 41.25).Select
Selection.OnAction = "rick_mc"
Application.CommandBars("Forms").Visible = False
End Sub


Assuming you already have a macro called "rick_mc". This macro creates a
button and does the assignment.
--
Gary''s Student
gsnu200712

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Button to activate macro

Plaigerizing Jim a little here, In the workbook where you
want the button: Press Alt + f11 to open the VB editor.
Click on ThisWorkbook in the Project Window at left and paste Jim's
code as modified into the code module.

Sub Workbook_Open()
'
' Macro1 Macro
' Macro recorded 3/28/2007 by jim ravenswood

Application.CommandBars("Forms").Visible = True
ActiveSheet.Buttons.Add(290.25, 69, 51.75, 41.25).Select
Selection.OnAction = "rick_mc"
Application.CommandBars("Forms").Visible = False
End Sub




"Gary''s Student" wrote:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/28/2007 by jim ravenswood
'

'
Application.CommandBars("Forms").Visible = True
ActiveSheet.Buttons.Add(290.25, 69, 51.75, 41.25).Select
Selection.OnAction = "rick_mc"
Application.CommandBars("Forms").Visible = False
End Sub


Assuming you already have a macro called "rick_mc". This macro creates a
button and does the assignment.
--
Gary''s Student
gsnu200712

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
button in a cell to activate a macro alexfair Excel Worksheet Functions 6 May 30th 08 03:09 PM
Activate Macro Button Located In Another File Aria[_2_] Excel Programming 2 October 26th 06 02:03 AM
activate/deactivate button with macro at given condition arcq Excel Programming 1 March 17th 05 05:35 AM
How to activate the button junx13[_3_] Excel Programming 1 June 10th 04 11:50 AM
Macro to activate form button kkknie[_90_] Excel Programming 1 May 11th 04 08:31 PM


All times are GMT +1. The time now is 03:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"