Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Is it possible to add a sub that can be used to set all variables: Private Sub Workbook_Open() Run setvalues End Sub Public Sub myvalues() ProjectTitle = "my Project" End Sub Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Yes, it's possible... The secret is to declare the variables outside your macro (at the top of the module). Try this: Private Sub Workbook_Open() Call myvalues Call output End Sub Dim ProjectTitle As String Public Sub myvalues() ProjectTitle = "my Project" End Sub Sub output() msg = MsgBox("ProjectTitle = " & ProjectTitle) End Sub For more information about declaring variables, look at this: http://www.cpearson.com/excel/variables.htm Best regards, Per "MM User" skrev i meddelelsen ... Hi, Is it possible to add a sub that can be used to set all variables: Private Sub Workbook_Open() Run setvalues End Sub Public Sub myvalues() ProjectTitle = "my Project" End Sub Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Per - that's great!
"Per Jessen" wrote in message ... Hi Yes, it's possible... The secret is to declare the variables outside your macro (at the top of the module). Try this: Private Sub Workbook_Open() Call myvalues Call output End Sub Dim ProjectTitle As String Public Sub myvalues() ProjectTitle = "my Project" End Sub Sub output() msg = MsgBox("ProjectTitle = " & ProjectTitle) End Sub For more information about declaring variables, look at this: http://www.cpearson.com/excel/variables.htm Best regards, Per "MM User" skrev i meddelelsen ... Hi, Is it possible to add a sub that can be used to set all variables: Private Sub Workbook_Open() Run setvalues End Sub Public Sub myvalues() ProjectTitle = "my Project" End Sub Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Global Variables | Excel Programming | |||
Global variables | Excel Programming | |||
Global Variables | Excel Programming | |||
global variables | Excel Programming | |||
Global Variables | Excel Programming |