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.
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Hap

Well-known Member
Joined
Jul 20, 2005
Messages
647
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,608
Messages
5,597,143
Members
414,129
Latest member
mr vba

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
Top