G
Guest
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
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