Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Global Variables

Posted on 2003-11-04
4
Medium Priority
?
519 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 80 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

597 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