Source control of Excel VBA code modules

前端 未结 6 1623
忘了有多久
忘了有多久 2020-12-02 10:19

I\'d like to be able to source control my Excel spreadsheet\'s VBA modules (currently using Excel 2003 SP3) so that I can share and manage the code used by a bunch of differ

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 10:53

    Usually the "Loader1" thing happens when Excel is asked to import a module and a module already exists with the same name. So if you import "Loader", then load it again and you'll get "Loader1". This would be because Excel doesn't know (or maybe just doesn't care) if it's really the same thing or a new chunk of functionality that just happens have the same module name, so it imports it anyway.

    I can't think of a perfect solution, but I think I'd be inclined to try putting the load/unload logic in an add-in - that Workbook_Open thing looks a little vulnerable and having it in all workbooks is going to be a huge pain if the code ever needs to change (never say never). The XLA logic might be more complex (trickier to trap the necessary events, for one thing) but at least it'll only exist in one place.

提交回复
热议问题