MicroSoft 沒有文件顯示 編碼 的大小限制 64K 太大,很難跟進 以下編碼檢示 Module 的大小 Sub get_Mod_Size() Dim myProject As Object Dim ComName As String Dim tempPath As String Dim fs As Object, a As Object Dim result As String ' ************************************************************************************** ' Use this to determine the size of a module ' Set ModName (component name) and tempPath (where to store the temp fule), then run ' ************************************************************************************** ' Set these to run ComName = "Module1" tempPath = "c:\Test.bas" ' ***** No action needed after this point ***** ' Export the component (module, form, etc) - this is only temporary Set myProject = Application.VBE.ActiveVBProject.VBComponents myProject(ComName).Export (tempPath) ' Get the size of the file created Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.getfile(tempPath) result = ComName & " uses " & (a.Size / 1000) & " KB." ' Return the file size MsgBox result, vbExclamation ' Delete the exported file fs.Deletefile tempPath End Sub
[此贴子已经被作者于2006-9-27 15:39:14编辑过] |