At the moment I have created an excel/macro worksheet that works, it calls the information from a database and creates a report file with the specific desired data in it.
The problem is that this file is going to be used and renamed allot of times. At the moment if I run say "Alarms1", the macro connection within the toolbar reads 'D:\Report Template\Test 1\Alarms1.xls'!RunQueries'. This works.
However if I run a file called "Comms1", the macro connection within the toolbar remains 'D:\Report Template\Test 1\Alarms1.xls'!RunQueries'. I must reconnect each time I want to run another file.
I have asked this before and was given (Below). But it doesn't seem to work.
Private Sub Workbook_Open()
Sheets("Sheet 1").Shapes("Button 1").OnAction = ThisWorkbook.Name & "!MyMacro
End Sub
Can anyone suggest the code or even a solution around this?
The problem is that this file is going to be used and renamed allot of times. At the moment if I run say "Alarms1", the macro connection within the toolbar reads 'D:\Report Template\Test 1\Alarms1.xls'!RunQueries'. This works.
However if I run a file called "Comms1", the macro connection within the toolbar remains 'D:\Report Template\Test 1\Alarms1.xls'!RunQueries'. I must reconnect each time I want to run another file.
I have asked this before and was given (Below). But it doesn't seem to work.
Private Sub Workbook_Open()
Sheets("Sheet 1").Shapes("Button 1").OnAction = ThisWorkbook.Name & "!MyMacro
End Sub
Can anyone suggest the code or even a solution around this?