I am responsible to modify the Global file of MS Project. It contains a custom made module which is constantly updated. I am distributing it to other users which do not have the computer skills to update their own file (I know it's just copy paste). I would like to know if there is a way I can code something in the Global file which checks for the latest version that is stored on a shared drive and copies and pastes in the other users computers?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use the Project_Open event in the ThisProject module of your global.mpt file to periodically update the code in a different module in the same file (e.g. the "Main" module):
Dim LastUpdated As Date
Private Sub Project_Open(ByVal pj As Project)
' run update if more than 1 hour since last update
If Now - LastUpdated > (1 / 24) Then
With ThisProject.VBProject
.VBComponents.Remove .VBComponents("Main")
.VBComponents.Import "c:\temp\main.bas"
End With
LastUpdated = Now
End If
End Sub