Its pretty annoying having to manually save every related add-in referenced by a workbook. How can I automatically save them upon saving the workbook?
So, in the workbook itself I have code in the "ThisWorkbook" module:
And in one of my main shared Add-In modules (named "Workbook"), I have:
While this works for all opened workbooks (not just directly referenced ones), it doesn't appear to find the add-ins...
Any help would be greatly appreciated.
Cheers
So, in the workbook itself I have code in the "ThisWorkbook" module:
Code:
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
If Success Then Call Workbook.SaveAll(ThisWorkbook.Name)
End Sub
And in one of my main shared Add-In modules (named "Workbook"), I have:
Code:
Private Saving_Workbooks As Boolean
Public Sub SaveAll(pCurrentWorkBook As String)
Dim wb
If (Not Saving_Workbooks) Then
'prevent infinite loop
Saving_Workbooks = True
For Each wb In Application.Workbooks
If ((Not wb.ReadOnly) And _
(Windows(wb.Name).Visible) And _
(wb.Name <> pCurrentWorkBook)) Then
wb.Save
End If
Next
'allow all workbooks to be saved again
Saving_Workbooks = False
End If
End Sub
While this works for all opened workbooks (not just directly referenced ones), it doesn't appear to find the add-ins...
Any help would be greatly appreciated.
Cheers
Last edited: