LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Passing arguments to a sub routine...

I've written some code in Excel and I'm developing the Error Handling
portion of it. I've written a small subroutine that will generate (or
append to) an error log so that I can track any errors that I might get.

What I've done (and tested) is create the following subroutine

'
'
'
Sub ErrLog (strModule as String, intError as Integer, strDesc as String)
Dim strOutput as String

strOutput = "An error was report from Module - " & strModule & ". The
error is " & intError & " " & strDesc

Open "C:\ErrorLog.txt" for Append as #1
Write #1, strOutput

Close #1

End Sub

The variables that I'm passing it are
strModule (which is the name of the subroutine that the error
occurred)
intError (which is the actual error number)
strDesc (which is the error's description)


I'm using the standard error trapping routine...

Sub Proc1( )

On Error GoTo Proc1Error


Proc1Error_Exit:
Exit Sub
Proc1Error:
ErrLog ("Proc1", Err.Number, Err.Description)
Resume Proc1Error_Exit

End Sub

I'm getting an error message indicating that it's expecting an "=". If I
modify the ErrLog subroutine so that it only accepts the strModule variable
and I eliminate the Err.Number and Err.Description from the line that calls
ErrLog, everything works as I want it to.

Can I not pass Err.Number or Description to another subroutine?

Thanks.

Jeff


 
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 Arguments in Excell UB Excel Worksheet Functions 3 February 13th 07 04:08 PM
Passing Arguments in Excell function UB Excel Discussion (Misc queries) 2 February 13th 07 03:19 PM
Passing Variable Number of Arguments to a Sub blatham Excel Discussion (Misc queries) 4 December 10th 05 10:36 AM
Passing ARGUMENTS between event procedures of a USERFORM jason Excel Programming 8 November 10th 03 07:36 PM
Question: Macro overloading, passing variable number of arguments Frederik Romanov Excel Programming 1 July 8th 03 02:51 PM


All times are GMT +1. The time now is 06:39 AM.

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

About Us

"It's about Microsoft Excel"