Hi, colleagues all,
The functionality I wish to add to a series of workbooks is for each one (the master) to open another workbook in the background, update the background workbook with data from the master and then close the background workbook when the master closes.
MS Excel Help tells me that at the Application level, one must create and Application object with the With Events directive and then link it to the current application, but that this is not necessary with Workbook and Worksheet events.
The VBA code that I have added to Module 1 of each workbook is as follows:
Global ThisWorkBook As String
Private Sub Workbook_Open()
ThisWorkBook = Workbooks(1).Name
' MsgBox ThisWorkBook
Workbooks.Open Filename:="E:\Data\Dunelm\Projects\m_fust\InvoiceL ist.xls"
' MsgBox "InvoiceList opened"
End Sub
Private Sub Workbook_BeforeClose()
Workbooks("InvoiceList.xls").Close
End Sub
(The Global bits are used by the updating functions in Personal.xls).
My problem is that this code is not run when I open any of the workbooks. I have turned the macro security down to its lowest setting and turned off all protection, but without success. I bet I am missing something absurdly simple here, but I am more au fait with Access and larger systems. I promise not to hate anyone who can highlight my shortcomings in this area.
Regards,
Jim Wright.