问题
I have written a vba code in a workbook (with many modules) and I need to send the archive (such as Setup.XLSB) including the new code to other people at my work.
After they open the Setup.XLSB and click an installer button in order to Call the install_new_modules_inside_personal() , it should replace old modules inside the PERSONAL.XLSB with the new ones.
If the user has already his own modules in PERSONAL.XLSB, I don’t want them to be deleted. I just want my modules including the new code to replace my old ones with the same name.
Private Sub Install_new_modules_inside_personal()
Dim Ver As String
Ver = "3" 'Number of version. Insert manually.
Dim startupFolder As String
startupFolder = Application.StartupPath
'Setup archive check
If ActiveWorkbook.Name <> "Setup.XLSB" Then
MsgBox ("Error message.")
Exit Sub
End If
'Version check. This one here is OK.
'Check if PERSONAL.XLSB else save Setup.XLSB as PERSONAL in Application.StartupPath
'export – import code goes here
End Sub
来源:https://stackoverflow.com/questions/22465984/replacement-of-old-modules-with-updated-ones-in-personal-xlsb