Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2005, 04:33 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default Class module variables in VB6

Hi,

I have made an ActiveX DLL with a few class modules in it. In each class module, a few subroutines exist.
I have one class module, where it is important to remember a specific variable set in a subroutine. I made this variable public using the "public" statement. These subroutines are called from Excel.
However, when I print this variable out in another subroutine (i.e. msgbox (variable) ) , it says the variable isnt set (msgbox nothing)

There is a way to store these variables in the memory. But how? Does the DLL not remember the variables because it is called from Excel?

Help will be appreciated
Max
 
Old September 18th, 2005, 11:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I variable at module level is valid until the class goes out of scope. For example, the variable

private m_localVariable as Long

is recognized in all the methods of the same class, but it is lost when the class is destroyed.
Can you publish your code? Maybe there is something else going on
Marco
 
Old September 18th, 2005, 12:15 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi marco,

I just found out how it works, exactly how you said it would work. I have put the variables in cells, so the problem is solved.

Thanks for the help anyway.

Max





Similar Threads
Thread Thread Starter Forum Replies Last Post
Option Group Variables (from Form to Module) emanuele.musa VB How-To 1 July 20th, 2007 03:58 PM
Accessing UDFs in MS Access Module from VB6 tembe_c VB How-To 1 November 26th, 2005 08:31 AM
how to pass value between class module? yvon Pro VB 6 1 November 23rd, 2005 12:58 PM
Module.InsertText affecting unrelated variables! DaDeViL Access VBA 1 October 16th, 2005 12:43 AM
CFormChanger Class module maccas Excel VBA 0 September 28th, 2004 07:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.