ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating Buttons and assigning code (https://www.excelbanter.com/excel-programming/303935-creating-buttons-assigning-code.html)

winshent

Creating Buttons and assigning code
 
I have written some code which copies certain sheets from my master
workbook into a new workbook.

So far I have written the code that creates the workbook, copies the
sheets accross, creates modules with in the workbook and write
procedures to them and then saves.

I want to add buttons to sheets in the new workbook and assign the
code to those buttons. How do i do this?

using the following code seems to set the button to try and run code
from the master workbook.

ActiveSheet.Shapes("Button1").Select
Selection.OnAction = "cmdButton1"

Any Ideas?

Many thanks

Vincent

Don Guillett[_4_]

Creating Buttons and assigning code
 
try this idea
Sub assignmacrotoshape()
ActiveSheet.Shapes("Unhide_Btn").OnAction = "Hide_Overtime"
End Sub
--
Don Guillett
SalesAid Software

"winshent" wrote in message
om...
I have written some code which copies certain sheets from my master
workbook into a new workbook.

So far I have written the code that creates the workbook, copies the
sheets accross, creates modules with in the workbook and write
procedures to them and then saves.

I want to add buttons to sheets in the new workbook and assign the
code to those buttons. How do i do this?

using the following code seems to set the button to try and run code
from the master workbook.

ActiveSheet.Shapes("Button1").Select
Selection.OnAction = "cmdButton1"

Any Ideas?

Many thanks

Vincent




Gord Dibben

Creating Buttons and assigning code
 
Have a browse through the info and code here........

http://msdn.microsoft.com/library/de...l/ofcmdbar.asp

Gord Dibben Excel MVP


On 13 Jul 2004 07:34:12 -0700, (winshent)
wrote:

I have written some code which copies certain sheets from my master
workbook into a new workbook.

So far I have written the code that creates the workbook, copies the
sheets accross, creates modules with in the workbook and write
procedures to them and then saves.

I want to add buttons to sheets in the new workbook and assign the
code to those buttons. How do i do this?

using the following code seems to set the button to try and run code
from the master workbook.

ActiveSheet.Shapes("Button1").Select
Selection.OnAction = "cmdButton1"

Any Ideas?

Many thanks

Vincent



winshent

Creating Buttons and assigning code
 
Thanks guys..

Will let you know if i have any problems

Vincent


All times are GMT +1. The time now is 11:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com