I always define these things as global and set them to Nothing:
Dim FileName : Set FileName = Nothing Therefore, this would resolve your issues. From: J.J. Meddaugh [mailto:[email protected]] Sent: Friday, January 08, 2010 12:11 PM To: [email protected] Subject: Re: Error Reporting No parms is a variable I've set later in the script. It dies on the first if not filename is nothing then because filename wasn't defined. I want to act on the variable only if it exists. J.J. Meddaugh - ATGuys.com A premier Licensed Code Factory and KNFB Reader distributor ----- Original Message ----- From: Jeff Bishop <mailto:[email protected]> To: [email protected] Sent: Friday, January 08, 2010 2:08 PM Subject: RE: Error Reporting Parms for example looks to be an object so you need to return a property. I do this a lot in the Winamp scripts to gather data to send along with error reports. From: J.J. Meddaugh [mailto:[email protected]] Sent: Friday, January 08, 2010 12:02 PM To: [email protected] Subject: Error Reporting I want to append details to an error report, but the variables I would be sending are only active in certain instances. I tried setting up a function like this Function ErrorData() if not filename is nothing then ErrorData = ErrorData & "Filename: " & filename & vbCrLf end if if not parms is nothing then ErrorData = ErrorData & "parms: " & parms & vbCrLf end if End Function But it still generates an error at script launch because the variables aren't active. Is there a better way to do this, or should I just put the append info right by the part of the script where these variables are active? That method seems cluttered. J.J. Meddaugh - ATGuys.com A premier Licensed Code Factory and KNFB Reader distributor
