VbComponents.Remove doesn't always remove module

后端 未结 8 892
我寻月下人不归
我寻月下人不归 2021-01-02 01:01

I\'m trying to use Chip Pearson\'s code for overwriting an existing VBA code module with an import from another project. Original code here.

The particular section

8条回答
  •  渐次进展
    2021-01-02 01:10

    As Chip Pearson stated, the only way to manage components in a Workbook without conflict is to use code from within another Workbook. I have put everything I need into a CompMan.xlam Workbook which I use as Add-In. It allows me to export all modules from a Workbook whenever it is saved by the simple code lines:

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    #If DevTest Then
       mCompMan.ExportAll ThisWorkbook
    #End If
    End Sub
    

    By this I never again loose any VBA work and moreover any module is available for import into any other Workbook. I should add that I keep Workbooks with Macros in dedicated folders - at least for code work.

提交回复
热议问题