Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have to modify 2000 files so I've written a master file that loops through
a list, importing modules and forms into the 2000 files it opens and closes. On each file when open it draws a button on worksheet. I then want to assign a macro to the button called "ModifyMenu" . The code for 'Modifymenu' is imported into file_01.xls and is a unique name. It does not exist is master.xls, so no confusion. The code for assigning the code is as follows : Windows("file_01.xls").Activate ActiveSheet.Shapes("Button").Select or Workbooks("file_01.xls").Sheets("1 B").Shapes("Button").Select Then Selection.OnAction = "ModifyMenu" (This links to master.xls!ModifyMenu not file_01.xls) Selection.OnAction = "file_01.xls!ModifyMenu" (This fails, runtime 1004. 'Unable to set the OnAction property of the button class) Selection.OnAction = ThisWorkbook.Name & "!ModifyMenu" (This links to master. MAster is the active code even though 'file_01.xls' is the active worksheet) Variations on the above seem to result in the same 1004 error or linking back to master regardless of the fact I'm trying to link to file_01.xls. Any help much appricated. Regards Nick |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assign a macro to a button | Excel Discussion (Misc queries) | |||
Button assign macro breaks with file name change and appears elsew | Excel Discussion (Misc queries) | |||
How do I Assign Macro to a button? | Charts and Charting in Excel | |||
Assign macro to button | Excel Programming | |||
Assign button to run macro | Excel Programming |