Limits in AutoCAD2000 VBA?

Limits in AutoCAD2000 VBA?

Anonymous
Not applicable
248 Views
6 Replies
Message 1 of 7

Limits in AutoCAD2000 VBA?

Anonymous
Not applicable
I have made some code to my VBA project in AutoCAD2000.
All my VBA code is in one DVB-file and the size of my dvb file is now 1.9
Mb.

How near are the limits of the VBA of AutoCAD2000?
How big can a dvb file be?
How many modules/forms can be in one project?
How many prosedures can be in a module/ in a project?
How much code can be in a module (in Excel5 there can be 64 kb of text, it
means something like 2000 lines).
What will happen if my project is too big?
How does the amount of RAM affect?
Is there any document (e.g. white paper, technical reference,...) about the
known limits?

Thanks for all
0 Likes
249 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Have you considered moving some of your code into a compiled VB6 DLL? I
can't imagine that 2MB of interpreted text would perform that well.

Esa Salmikangas wrote in message <8a7k45$he83@adesknews2.autodesk.com>...
>I have made some code to my VBA project in AutoCAD2000.
>All my VBA code is in one DVB-file and the size of my dvb file is now 1.9
>Mb.
>
>How near are the limits of the VBA of AutoCAD2000?
>How big can a dvb file be?
>How many modules/forms can be in one project?
>How many prosedures can be in a module/ in a project?
>How much code can be in a module (in Excel5 there can be 64 kb of text, it
>means something like 2000 lines).
>What will happen if my project is too big?
>How does the amount of RAM affect?
>Is there any document (e.g. white paper, technical reference,...) about the
>known limits?
>
>Thanks for all
>
>
0 Likes
Message 3 of 7

Anonymous
Not applicable
Thanks.

Maybe I should, because I suppose that I'm just on half-way, so in the final
application I will have much more code than 2 Mb. I will think it over very
carefully.

But no any facts ot rumours about limits of VBA?

Esa Salmikangas

Bill Daly kirjoitti viestissä <8a87oe$he99@adesknews2.autodesk.com>...
>Have you considered moving some of your code into a compiled VB6 DLL? I
>can't imagine that 2MB of interpreted text would perform that well.
>
>Esa Salmikangas wrote in message <8a7k45$he83@adesknews2.autodesk.com>...
>>I have made some code to my VBA project in AutoCAD2000.
>>All my VBA code is in one DVB-file and the size of my dvb file is now 1.9
>>Mb.
>>
>>How near are the limits of the VBA of AutoCAD2000?
>>How big can a dvb file be?
>>How many modules/forms can be in one project?
>>How many prosedures can be in a module/ in a project?
>>How much code can be in a module (in Excel5 there can be 64 kb of text, it
>>means something like 2000 lines).
>>What will happen if my project is too big?
>>How does the amount of RAM affect?
>>Is there any document (e.g. white paper, technical reference,...) about
the
>>known limits?
>>
>>Thanks for all
>>
>>
>
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
Hi,
Here's a cut & paste from from the MSDN Library. It's for VB6 but since
that's built with VBA, some of the limitations probably apply.

- Tom

Control Limitations

Each nongraphical control (all the controls except shape, line, image,
and label) uses a window. Each window uses system resources, limiting
the total number of windows that can exist at one time. The exact limit
depends on the available system resources and the type of controls used.

To reduce consumption of system resources, use the shape, line, label,
and image controls instead of picture box controls to create or display
graphics.

Total Number of Controls
The maximum number of controls allowed on a single form depends on the
type of controls used and available system resources. However, there is
a fixed limit of 254 control names per form. A control array counts only
once toward this limit because all the controls in the array share a
single control name.

The limit on control array indexes is 0 to 32,767 on all versions.

If you layer controls on top of each other, such as using several frame
controls within other frames, Visual Basic will generally accept no more
than 25 levels of nested controls.

Limitations for Particular Controls
The following table lists property limitations that apply to particular
controls in Visual Basic.

Property Applies to Limitation
List and ListCount List box and combo box controls Maximum number of
items is 32K; the limit on the size of each item is 1K (1024 bytes).
Text Text box control Limited to 64K.
Caption Label control Limited to 1024 bytes.
Command button, check box, frame, and option button controls Limited
to 255 characters. Any caption over these limits is truncated. Captions
on custom control properties are limited to 32K.
Menu control Limited to 235 characters.
Tag All controls Limited only by available memory.
Name All controls Limited to 40 characters.

Note In Visual Basic, control property names are limited to 30
characters.

Code Limitations

The amount of code that can be loaded into a form, class, or standard
module is limited to 65,534 lines. A single line of code can consist of
up to 1023 bytes. Up to 256 blank spaces can precede the actual text on
a single line, and no more than twenty-four line-continuation characters
( _) can be included in a single logical line.

Procedures, Types, and Variables
There is no limit on the number of procedures per module. Each procedure
can contain up to 64K of code. If a procedure or module exceeds this
limit, Visual Basic generates a compile-time error. If you encounter
this error, you can avoid it by breaking extremely large procedures into
several smaller procedures, or by moving module-level declarations into
another module.

Visual Basic uses tables to store the names of identifiers (variables,
procedures, constants, and so on) in your code. Each table is limited to
64K.

DLL Declare Table
Each form and code module uses a table that contains a structure
describing a DLL entry point. Each structure uses approximately 40
bytes, with a total restricted size of 64K, resulting in roughly 1,500
declarations allowed per module.

Project-Name Table
The entire application uses a single table that contains all names.
These include:

Constant names

Variable names

User-defined - type definition names

Module names

DLL-procedure declaration names
The project name table is unlimited in total size, but is limited to a
total of 32K case-sensitive unique entries. If the limit is reached,
reuse private identifiers in different modules to limit the number of
unique entries to 32K.

Import Table
Every reference to an identifier in a different module creates an entry
in the Import Table. Each such entry is a minimum of 24 bytes and is
restricted to 64K, resulting in roughly 2,000 references per module.

Module-Entries Table
This table accepts up to 125 bytes per module, with a total limit of
64K, resulting in about 400 modules per project.

Data Limitations

The following limitations apply to variables in the Visual Basic
language.

Form, Standard, and Class Module Data
The data segment (that is, the data defined in the Declarations section)
of the VBA module of any form or module in Visual Basic can be up to
64K. This data segment contains the following data:

Local variables declared with Static.

Module-level variables other than arrays and variable-length strings.

4 bytes for each module-level array and variable-length string.
Procedures, Types, and Variables
If a procedure or module exceeds the 64K code limit, Visual Basic
generates a compile-time error.

If you define a procedure that has more than 64K of local variables
defined, you get the error "Too many local nonstatic variables."

If you define a module that has more than 64K of module-level variables
defined, or if you define a User-Defined Type larger than 64K, you get
the error "Fixed or static data can't be larger than 64K."

If you encounter this error, you can avoid it by breaking extremely
large procedures into several smaller procedures, or by moving
module-level declarations into another module.

An array declared as a variable doesn't contribute to the entire size of
the array; only the array descriptor counts toward the 64K limit. So it
is acceptable, for example, to have a declaration such as Dim x(1000000)
As Byte either in a procedure or at module level. Out of memory problems
occur, however, if you declare a large, fixed-size array in a record,
then declare instances of those records as variables.

User-Defined Types
No variable of a user-defined type can exceed 64K, although the sum of
variable-length strings in a user-defined type may exceed 64K
(variable-length strings occupy only 4 bytes each in the user-defined
type; the actual contents of a string are stored separately).
User-defined types can be defined in terms of other user-defined types,
but the total size of the types cannot exceed 64K.

Stack Space
Arguments and local variables in procedures take up stack space at run
time. Module-level and static variables do not take up stack space
because they are allocated in the data segment for forms or modules. Any
DLL procedures you call use this stack while they are executing.

Visual Basic itself uses some of the stack for its own purposes, such as
storing intermediate values when evaluating expressions.

Total available stack size for Visual Basic is one megabyte (1MB) per
thread. A stack may grow beyond this, however, if there is adjacent free
memory.

For More Information For tips on conserving stack space, see
"Designing for Performance and Compatibility."

System Resource Limitations

Some limitations on Visual Basic, and the applications you create with
it, are imposed by Microsoft Windows. These limitations may change when
you install a different version of Microsoft Windows.

Windows Resources
Every open window uses some system resources (data areas used by
Microsoft Windows). If you run out of system resources, the run-time
error "Windows is running low on available resources" occurs. You can
check the percentage of system resources remaining by choosing About in
the Windows Explorer Help menu in Windows 95/98 and Windows NT 4.0 or
later. Applications can also call the Windows API GetFreeSystemResources
to reclaim system resources, close windows (such as open forms and Code
windows, as well as windows in other applications), and exit running
applications.
0 Likes
Message 5 of 7

Anonymous
Not applicable
Note that VB6 programmers can save some resources by using the lightweight
"windowless" controls in the Common\Tools\Vb\WinLess directory on the CD
(CD3 on Visual Studio). They function the same as their "heavier"
counterparts, except that they don't have a hWnd property and don't support
DDE.
--Bill

Tom Gilmer wrote in message <8aaqru$t2l1@adesknews2.autodesk.com>...

>Each nongraphical control (all the controls except shape, line, image,
>and label) uses a window. Each window uses system resources, limiting
>the total number of windows that can exist at one time. The exact limit
>depends on the available system resources and the type of controls used.
0 Likes
Message 6 of 7

Anonymous
Not applicable
Hi Esa;

I'm not sure if this is fixed yet, but as of six months ago there was a problem
with DVB files growing and growing, even with no additions, just editing
routines or forms. There were two workarounds: First, try to simply save your
project under another name. Check to see if the file size has reduced. Second,
and more drastic, export all of your modules, start another new project and
import them into it. Save the project and see if it's much smaller. If so, get
rid of the original and rename the new one.

I guess either of these workarounds acts as a 'DVB Purge' . Hope this
helps,

...Colin French

Esa Salmikangas wrote:

> I have made some code to my VBA project in AutoCAD2000.
> All my VBA code is in one DVB-file and the size of my dvb file is now 1.9
> Mb.
>
> How near are the limits of the VBA of AutoCAD2000?
> How big can a dvb file be?
> How many modules/forms can be in one project?
> How many prosedures can be in a module/ in a project?
> How much code can be in a module (in Excel5 there can be 64 kb of text, it
> means something like 2000 lines).
> What will happen if my project is too big?
> How does the amount of RAM affect?
> Is there any document (e.g. white paper, technical reference,...) about the
> known limits?
>
> Thanks for all
0 Likes
Message 7 of 7

Anonymous
Not applicable
Well, in A2K it's sorta been fixed. After working on a project for
several days, its size grew to 105 Kb. Saving to a different name
reduced the size to 78 Kb. Much better than R14.01 but there's still
some excess baggage being carried.

Colin French wrote in message
news:38D6857C.E99BBC69@hotmail.com...
> Hi Esa;
>
> I'm not sure if this is fixed yet, but as of six months ago there was
a problem
> with DVB files growing and growing, even with no additions, just
editing
> routines or forms. There were two workarounds: First, try to simply
save your
> project under another name. Check to see if the file size has reduced.
Second,
> and more drastic, export all of your modules, start another new
project and
> import them into it. Save the project and see if it's much smaller. If
so, get
> rid of the original and rename the new one.
>
> I guess either of these workarounds acts as a 'DVB Purge' . Hope
this
> helps,
>
> ...Colin French
>
> Esa Salmikangas wrote:
>
> > I have made some code to my VBA project in AutoCAD2000.
> > All my VBA code is in one DVB-file and the size of my dvb file is
now 1.9
> > Mb.
> >
> > How near are the limits of the VBA of AutoCAD2000?
> > How big can a dvb file be?
> > How many modules/forms can be in one project?
> > How many prosedures can be in a module/ in a project?
> > How much code can be in a module (in Excel5 there can be 64 kb of
text, it
> > means something like 2000 lines).
> > What will happen if my project is too big?
> > How does the amount of RAM affect?
> > Is there any document (e.g. white paper, technical reference,...)
about the
> > known limits?
> >
> > Thanks for all
>
0 Likes