Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
Hi All, I have a 2 forms which rely heavily on a variable called -Vendor-. I have declaired it in the first form as: -Public Vendor As String- The only problem is that the second form fails to pick up the data in this variable. Can anyone help me please? Thank you :) -- Sami82 ------------------------------------------------------------------------ Sami82's Profile: http://www.excelforum.com/member.php...o&userid=27111 View this thread: http://www.excelforum.com/showthread...hreadid=474024 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
Hi Sami82,
Try moving Public Vendor As String from the userform module to the head of a standard module. --- Regards, Norman "Sami82" wrote in message ... Hi All, I have a 2 forms which rely heavily on a variable called -Vendor-. I have declaired it in the first form as: -Public Vendor As String- The only problem is that the second form fails to pick up the data in this variable. Can anyone help me please? Thank you :) -- Sami82 ------------------------------------------------------------------------ Sami82's Profile: http://www.excelforum.com/member.php...o&userid=27111 View this thread: http://www.excelforum.com/showthread...hreadid=474024 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
"Sami82" schrieb im Newsbeitrag ... Hi All, I have a 2 forms which rely heavily on a variable called -Vendor-. I have declaired it in the first form as: -Public Vendor As String- The only problem is that the second form fails to pick up the data in this variable. Can anyone help me please? Thank you :) -- Sami82 ------------------------------------------------------------------------ Sami82's Profile: http://www.excelforum.com/member.php...o&userid=27111 View this thread: http://www.excelforum.com/showthread...hreadid=474024 Sami82, declare ist as a public variable in a module, not in a form (which makes it globally accessible). cheers, Stephan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
Thank you for your speedy reply, Can this be situated in the "ThisWorkbook" section, because the macr runs automatically on startup -- Sami8 ----------------------------------------------------------------------- Sami82's Profile: http://www.excelforum.com/member.php...fo&userid=2711 View this thread: http://www.excelforum.com/showthread.php?threadid=47402 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
Hi Sam82,
Can this be situated in the "ThisWorkbook" section, because the macro runs automatically on startup? No, the global Vendor variable should be declared at the top of a standard module. Should you wish to initialise the Vendor variable in the workbook's opening event, try (in the ThisWorkbook module): Private Sub Workbook_Open() Vendor = "Joe Bloggs Inc" End Sub --- Regards, Norman "Sami82" wrote in message ... Thank you for your speedy reply, Can this be situated in the "ThisWorkbook" section, because the macro runs automatically on startup? -- Sami82 ------------------------------------------------------------------------ Sami82's Profile: http://www.excelforum.com/member.php...o&userid=27111 View this thread: http://www.excelforum.com/showthread...hreadid=474024 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
Hi All, I have transferred this to a seperate "startup" module which is called in "ThisWorkbook". Only problem is now I am getting an error when it gets to my first Public line, the error is: Compile error: Invalid attribute in Sub or Function" How can I fix this but still be able to use my variables across multiple forms? Thank you once again -- Sami82 ------------------------------------------------------------------------ Sami82's Profile: http://www.excelforum.com/member.php...o&userid=27111 View this thread: http://www.excelforum.com/showthread...hreadid=474024 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
"Sami82" schrieb im Newsbeitrag ... Hi All, I have transferred this to a seperate "startup" module which is called in "ThisWorkbook". Only problem is now I am getting an error when it gets to my first Public line, the error is: Compile error: Invalid attribute in Sub or Function" How can I fix this but still be able to use my variables across multiple forms? Thank you once again -- Sami82 Declare your variable before any sub Public Vendor As String Sub xyz .... end sub Stephan |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between forms
Worked a treat. Thank you! -- Sami82 ------------------------------------------------------------------------ Sami82's Profile: http://www.excelforum.com/member.php...o&userid=27111 View this thread: http://www.excelforum.com/showthread...hreadid=474024 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing variables from one sub to another | Excel Programming | |||
Passing Variables | Excel Programming | |||
passing variables | Excel Programming | |||
Passing Variables | Excel Programming | |||
Passing Variables | Excel Programming |