如果不用Dsofile.dll的话,VBA也提供了CustomeDocumentProperties的Add方法. A电脑上放 Sub UpdateVersion(strVersion As String) ThisWorkbook.CustomDocumentProperties.Add "VBA Verison", False, msoPropertyTypeString, strVersion End Sub B电脑上放 Function GetVersion(strName As String) As String Dim FileName As String Dim pptVer As DocumentProperty FileName = "\\yourNetworkPc\file.xls" Workbooks.Open FileName For Each pptVer In ActiveWorkbook.CustomDocumentProperties If pptVer.Name = strName Then GetVersion = ActiveWorkbook.CustomDocumentProperties(pptVer.Name) Exit For End If Next ActiveWorkbook.Close End Function 然后调用 Sub mmm() MsgBox GetVersion("VBA Version") End Sub |