MAximum Lines Of Code

J

jswalsh33

I found by accident that there is a maximum number of lines of code in a
single module in visual basic for Excel.

Is there a maximum number of lines of code for a project or for a workbook?

Thanks for your help,

Jim Walsh
 
P

Peter T

There used to be reports that modules with 64k of code as text may cause
problems, personally I have never had a problem even with modules containing
somewhat more. I wouldn't be surprised if ultimately there's some maximum
lines limit (there is a characters wide limit).

However, it's generally not good practice nor necessary for a module to get
anywhere close to any theoretical size limit.

Regards,
Peter T
 
J

jswalsh33

Peter T said:
There used to be reports that modules with 64k of code as text may cause
problems, personally I have never had a problem even with modules containing
somewhat more. I wouldn't be surprised if ultimately there's some maximum
lines limit (there is a characters wide limit).

However, it's generally not good practice nor necessary for a module to get
anywhere close to any theoretical size limit.

Regards,
Peter T



Peter,

Yes I learned that there is a maximum for a single module. I did not measure
it, but it was probably around 64K.

My question now is whether there is a maximum number of lines of code for a
project with many modules or maybe there is a maximum number of modules in a
single project.

Thanks for you help.

Jim Walsh
 
N

norie

Jim

I don't think there is such a limit.

By the way if you are reaching the limits for lines of code it really
suggests that you should review your code.

Care to post a small sample?

Perhaps we could offer a few pointers on tidying up/shortening the
code.
 
J

jswalsh33

norie said:
Jim

I don't think there is such a limit.

By the way if you are reaching the limits for lines of code it really
suggests that you should review your code.

Care to post a small sample?

Perhaps we could offer a few pointers on tidying up/shortening the
code.

Nori,

Thanks for your interest.
I really have too much code to list.
I have a single workbook with 41 Sub Routines (or Modules) of VB code.

I did have one sub that Excel warned me that I had too much code in that
Module so I split it into two modules and that worked fine.

My current issue is that Excel is doing some strange things as I add more
code and more modules. I was speculating that these may have been caused by
exceeding some limit on modules or code.

An example is that Excel crashes every time I click ok to the massage "This
action will reset your project, proceed anyway?" while editing code. If I
reset it myself it does not crash.

This does not happen on other smaller projects I have.

Regards,

Jim Walsh
 
N

norie

Jim

I really, really think you need to have a rethink.

Why do you have 41 subs/modules?

I know splitting code into separate subs will work, but that's a bit
like putting a plaster on a head wound.:)

Can you post any of your code? Or perhaps an explanation of what it's
actually meant to do.
 
J

jswalsh33

norie said:
Jim

I really, really think you need to have a rethink.

Why do you have 41 subs/modules?

I know splitting code into separate subs will work, but that's a bit
like putting a plaster on a head wound.:)

Can you post any of your code? Or perhaps an explanation of what it's
actually meant to do.
Norie,

Thanks again for your interest.

I am a novice programmer and I am working on a very large project as a
learning experience.

I know my code could probably be much improved, but at this point in my
learning I am struggling just to learn how to make the code do what I want it
to do. Once I get proficient at making it work, I think I can go back and
learn how to make the code more efficient.

The project is an information retrieval system for a cruise travel company.
The idea is to record all cruises ordered, the passenger names, addresses,
birth dates, passport number, destinations, etc and to be able to quickly
retrieve the travel history, payment history and personal information on any
passenger. It is being written to accommodate up to 1000 reservation and
5000 passengers, with an archiving capability is the numbers exceed those
values.

My Excel workbook has 15 worksheets, 5 of which are operator interface for
various operator functions, 6 are reports, three are databases and 1 is a
scratch pad for computations.

As I said this is just for fun. I wasn't really looking for help with all of
this. I was just looking for information on any limitations there might be on
the size of the project.

Regards,

Jim Walsh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top