Solved

Re-use some class modules

Posted on 2002-07-16
3
134 Views
Last Modified: 2010-05-02
I have two different VB6 projects.
I want to re-use one class module from project A, so I opened the project B and selected "Add Class Module" to add the moda.cls file. But when I tried to compile project B, the following error occur:

Set  moda  = New moda
        ^          ^
"Compile error: Variable not defined"

Why? How can I fix this error?
Thank You.

raymng
0
Comment
Question by:raymng
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
ID: 7157222
Do you have somewhere the moda variable declared?

For problem like this, you should have the following line on top of each module:
OPTION EXPLICIT
this requests that you have every variable declare before you can use it in code.

CHeers
0
 

Author Comment

by:raymng
ID: 7157283
Oh, thanx!
I overlooked this.
0
 
LVL 10

Expert Comment

by:GoodJun
ID: 7157284
Don't use the same name with variable and class

dim objmoda as moda
Set  objmoda  = New moda
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now