Solved

Global Variables

Posted on 2003-11-04
4
512 Views
Last Modified: 2010-05-03
What is the command in VB6 to set a variable in a module?

I want to say:
Variable1 = 25
but I don't remember how to say that...
0
Comment
Question by:JFrye
  • 2
4 Comments
 

Expert Comment

by:pyromatt
ID: 9679377
If the variable is global you should be able to say just that. To declare it globally you just use the following;

Global Variable1 as Integer
0
 

Author Comment

by:JFrye
ID: 9679459
I have that much, but I need to set the value of Variable1 to 25 in this example. How do I set the value?
0
 
LVL 4

Accepted Solution

by:
TomLaw1999 earned 20 total points
ID: 9679537
If the value is constant available to all forms then

Public Const Variable1 As Long = 25

_____________________________

if it is a true Public variable then
Public Variable1 As Long

Then enter the value 25 in an appropriate place i.e.

sub Main()
Variable1 = 25
end sub






0
 

Author Comment

by:JFrye
ID: 9680193
Oh yeah! The SubMain() was what I was looking for. Thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

20 Experts available now in Live!

Get 1:1 Help Now