Module size

Hap

Well-known Member
Joined
Jul 20, 2005
Messages
647
Is there a way to determine what percent or size each module is of the total file size? This would include each worksheet object. If I could create a tool programmatically to determine this it would be handy.

Thank you.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I just created the following tool trying to see what info I could extract.

Sub fileTool()

Dim a As String
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim t As Integer

i = 0
k = Application.ActiveWorkbook.VBProject.VBComponents.Count
For j = 1 To k
a = Application.ActiveWorkbook.VBProject.VBComponents.Item(j).CodeModule.Name
i = Application.ActiveWorkbook.VBProject.VBComponents.Item(j).CodeModule.CountOfLines
t = t + i
Next j

MsgBox "Number of lines of code = " & t & " in a total of " & k & " modules and classes"

End Sub

This obviously includes blank lines also but its a start. The real question would be can I determine the actual size of each VBComponent.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,576
Members
449,173
Latest member
Kon123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top