Hi all.
I would like to add a test for the user of the database. I am looking to add this to my error handling, if I am not the user then I want the error message (user-Defined) to fire, a screen shot taken, and an email sent to me with the screen shot, variables from the user form and a copy of all the files that have been selected for processing.
Once I get all that data I should be able to recreate the issue and determine the fix.
If I am the user, I simply want the error handler to fire the message (user-defined).
I need to be able to capture both Access and Excel user names if the process is different. I like to maintain my error handling for all project as much as possible.
Here is my current error handler
Not really looking for a re-write as I should be able to handle writing most of this with some research. However, I am not even sure where to look for the username.
Thanks,
Rich
I would like to add a test for the user of the database. I am looking to add this to my error handling, if I am not the user then I want the error message (user-Defined) to fire, a screen shot taken, and an email sent to me with the screen shot, variables from the user form and a copy of all the files that have been selected for processing.
Once I get all that data I should be able to recreate the issue and determine the fix.
If I am the user, I simply want the error handler to fire the message (user-defined).
I need to be able to capture both Access and Excel user names if the process is different. I like to maintain my error handling for all project as much as possible.
Here is my current error handler
Code:
''=====================================================================================
' Program : errHAND
' Desc. : This Sub is used for error handling for the other subs.
' Called By : All other subs in this module
' Calls : None
' Arguments : strENUM As String, strELINE As String, strEDESC As String
' Comments : See in-line comments
'
' Changes----------------------------------------------------------------------------
'
' Date Programmer Change
' ---- ---------- -------------------------------------------------------
' UNK RBricker Written
' 10/15/15 RBricker Added Comments for clarity and error handling
'
''=====================================================================================
Private Sub errHAND(strENUM As String, strELINE As String, strEDESC As String)
Const strERRORMSG As String = "The Program has generated the following error", _
strERRORnbr As String = "Error Number: ", _
strERRORline As String = "error occured on line: ", _
strERRORdesc As String = "Error Description: ", _
strERRORocc As String = "An Error has Occured!"
Dim strFNAME As String, strFPATH As String, strKILLFILE As String
'**************************************************************************************
'***** Displays message box which describes the error which has occured and the line
' number.
'**************************************************************************************
MsgBox strERRORMSG & vbCrLf & vbCrLf & _
strERRORnbr & strENUM & vbCrLf & _
strERRORline & strELINE & vbCrLf & _
strERRORdesc & strEDESC, _
vbCritical, strERRORocc
'**************************************************************************************
'***** On error direction set to goto the next line of code
'**************************************************************************************
On Error Resume Next
'**************************************************************************************
'***** set Excel Application parameters
'**************************************************************************************
With oEXCEL
.ScreenUpdating = False
.DisplayAlerts = False
.Visible = True
End With
'**************************************************************************************
'***** sets strFNAME to oxWBRECON file name
'***** sets strFPATH to oxWBRECON file path and include character "\"
'***** sets strKILLFILE to strFPATH & strFNAME
'**************************************************************************************
strFNAME = oxWBRECON.Name
strFPATH = oxWBRECON.Path & "\"
strKILLFILE = strFPATH & strFNAME
'**************************************************************************************
'***** Closes oxWBRECON files without saving
'***** Set oxWS variable to nothing
'***** Set oxWBRECON variable to nothing
'***** Quit the Excel Application
'***** Set oEXCEL variable to nothing
'***** Delete file using strKILLFILE to identify the appropriate file.
'***** Set qdf variable to nothing
'***** Set db variable to nothing
'**************************************************************************************
oxWBRECON.Close False
Set oxWS = Nothing
Set oxWBRECON = Nothing
oEXCEL.Quit
Set oEXCEL = Nothing
Kill strKILLFILE
Set qdf = Nothing
Set db = Nothing
End
End Sub
Not really looking for a re-write as I should be able to handle writing most of this with some research. However, I am not even sure where to look for the username.
Thanks,
Rich