Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variable among controls [email protected] Excel Programming 2 January 26th 07 03:06 AM
Passing variable to VarType of other Variable ExcelMonkey[_190_] Excel Programming 3 February 22nd 05 01:38 PM
passing variable to file... Ernst Guckel[_2_] Excel Programming 1 June 2nd 04 05:46 PM
Passing a variable between workbooks Rich Cooper Excel Programming 1 May 19th 04 07:27 PM
Passing variable from one sub to another Medemper Excel Programming 0 February 26th 04 10:23 PM


All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"