![]() |
public variable question
Does the variable change?
If no, then you could use: Public Const myConst As String = "hi there" If yes, you could declare the variable as public, but then set it to its original value in the workbook_open event or auto_open procedure. Or you could be careful and check it before you try to use it: Public VarsPopulated as boolean public myVar as long ---- in some procedu if varspopulated = false then call PopulateVars end if ========= Sub PopulateVars() VarsPopulated = true myVar = 1234 End Sub Gary Keramidas wrote: is it possible to not only declare a public variable, but also set it to a value to be used throughout he app? -- Gary -- Dave Peterson |
public variable question
sorry about the time, that damn vista keeps changing it when i dual boot.
-- Gary "Dave Peterson" wrote in message ... Does the variable change? If no, then you could use: Public Const myConst As String = "hi there" If yes, you could declare the variable as public, but then set it to its original value in the workbook_open event or auto_open procedure. Or you could be careful and check it before you try to use it: Public VarsPopulated as boolean public myVar as long ---- in some procedu if varspopulated = false then call PopulateVars end if ========= Sub PopulateVars() VarsPopulated = true myVar = 1234 End Sub Gary Keramidas wrote: is it possible to not only declare a public variable, but also set it to a value to be used throughout he app? -- Gary -- Dave Peterson |
public variable question
is it possible to not only declare a public variable, but also set it to a value
to be used throughout he app? -- Gary |
public variable question
that's what i needed, i had public and const reversed.
thanks again -- Gary "Dave Peterson" wrote in message ... Does the variable change? If no, then you could use: Public Const myConst As String = "hi there" If yes, you could declare the variable as public, but then set it to its original value in the workbook_open event or auto_open procedure. Or you could be careful and check it before you try to use it: Public VarsPopulated as boolean public myVar as long ---- in some procedu if varspopulated = false then call PopulateVars end if ========= Sub PopulateVars() VarsPopulated = true myVar = 1234 End Sub Gary Keramidas wrote: is it possible to not only declare a public variable, but also set it to a value to be used throughout he app? -- Gary -- Dave Peterson |
All times are GMT +1. The time now is 12:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com