Hi
Have been struggling with the below, would really appreciate some advice!
I have a template workbook (call it "templatebook") that generates a new workbook ("newbook") with various sheets based on templates and data in templatebook using vba. There are two vba modules in templatebook that get exported to newbook. Once the two macros are in newbook I'm then trying to assign them to buttons on one of the sheets using:
Newbook.Activate
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.OnAction = "datarun"
ActiveSheet.Shapes.Range(Array("Button 2")).Select
Selection.OnAction = "dataclear"
The problem I'm having is that the buttons in the sheet in Newbook are being assigned by the above code to the relevant modules in the original templatebook and not to the modules in newbook. This means that to run the macros in newbook then templatebook has to open which is obviously what I don't want.
Could it be an object issue where I'm not being specific enough on which modules to assign the buttons to, and then because of this it assigns them to the modules in templatebook?
Thanks
Darren
Bookmarks