Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing a variable to a GoTo
I am trying to pass a public variable between modules to a Goto
statement. Example Public Sub Do_a_Lot (Err_Code) Dim Err_Code As Integer 'When something goes wrong On Error Resume Next Err_Code = 1 Call Errorcall(Err_Code) End Sub The in a seperate Module I have the Error handling Public Sub Errorcall(Err_Code) X=Err_Code Goto X: However the macro errors out when trying to initialise the Errorcall module because whilst compiling it hits the Goto statement with label X not defined, but it needs to be defined by the Err_code. Thanks in advance John |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing a variable to a GoTo
Select Case Err_Code
Not sure your use of Goto is the best approach though. Regards, Peter T "Planner" wrote in message ... I am trying to pass a public variable between modules to a Goto statement. Example Public Sub Do_a_Lot (Err_Code) Dim Err_Code As Integer 'When something goes wrong On Error Resume Next Err_Code = 1 Call Errorcall(Err_Code) End Sub The in a seperate Module I have the Error handling Public Sub Errorcall(Err_Code) X=Err_Code Goto X: However the macro errors out when trying to initialise the Errorcall module because whilst compiling it hits the Goto statement with label X not defined, but it needs to be defined by the Err_code. Thanks in advance John |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing a variable to a GoTo
On 14 Apr, 19:11, "Peter T" <peter_t@discussions wrote:
Select Case Err_Code Not sure your use of Goto is the best approach though. Regards, Peter T Thanks Peter - Sorted "Planner" wrote in message ... I am trying to pass a public variable between modules to a Goto statement. Example Public Sub Do_a_Lot (Err_Code) *Dim Err_Code As Integer * * *'When something goes wrong On Error Resume Next Err_Code = 1 Call Errorcall(Err_Code) End Sub The in a seperate Module I have the Error handling Public Sub Errorcall(Err_Code) X=Err_Code Goto X: However the macro errors out when trying to initialise the Errorcall module because whilst compiling it hits the Goto statement with label X not defined, but it needs to be defined by the Err_code. Thanks in advance John- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing variable among controls | Excel Programming | |||
Passing variable to VarType of other Variable | Excel Programming | |||
passing variable to file... | Excel Programming | |||
Passing a variable between workbooks | Excel Programming | |||
Passing variable from one sub to another | Excel Programming |