Hello all,
Another issue - I have an Excel 2003 macro that displays a form. If the form fields are entered incorrectly, a message box pops up with a message. The user clicks the "OK" button, but the message box does not go away. The main user form display and the message box can be seen behind it. Is there a way to ensure that the message box cannot be seen or does not display? Here is my code:
Has anyone had this issue before? Any help would be appreciated!!
Thanks!
Another issue - I have an Excel 2003 macro that displays a form. If the form fields are entered incorrectly, a message box pops up with a message. The user clicks the "OK" button, but the message box does not go away. The main user form display and the message box can be seen behind it. Is there a way to ensure that the message box cannot be seen or does not display? Here is my code:
Code:
Private Sub cmdAccept_Click()
' *--------------------------------------------*
' * Verify the user specificed Folder path *
' * locations exist. *
' *--------------------------------------------*
' *
Dim fs, pathName
On Error GoTo ErrorHandler
fFolderNotFND = "N"
lngC = &HFF& ' ** Set color value to Red **
Me.Hide
Set fs = CreateObject("Scripting.FileSystemObject")
' *-------------------------------------------------------*
' * Verify Supplemental Forms folder path location. *
' *-------------------------------------------------------*
' *
fFolder = LocSuppForms.Value
pathName = "Supp dolder path location does not exist. "
If Not fs.FolderExists(fFolder) Then
fFolderNotFND = "Y"
LocSuppForms.ForeColor = lngC
LocSuppForms.SetFocus
Else
InputDIR = fFolder
End If
' *-------------------------------------------------------*
' * Verify Output Workbooks folder path location. *
' *-------------------------------------------------------*
' *
If fFolderNotFND = "N" Then
fFolder = LocOutputWorkbooks.Value
pathName = "Output Workbooks folder path location does not exist. "
If Not fs.FolderExists(fFolder) Then
fFolderNotFND = "Y"
LocOutputWorkbooks.ForeColor = lngC
LocOutputWorkbooks.SetFocus
Else
OutputDIR = fFolder
End If
End If
' *-------------------------------------------------------*
' * Verify Backup Workbooks folder location. *
' *-------------------------------------------------------*
' *
If fFolderNotFND = "N" Then
fFolder = LocBackupWorkbooks.Value
pathName = "Backup folder location does not exist. "
If Not fs.FolderExists(fFolder) Then
fFolderNotFND = "Y"
LocBackupWorkbooks.ForeColor = lngC
LocBackupWorkbooks.SetFocus
Else
BackupDir = fFolder
End If
End If
' *-------------------------------------------------------*
' * If a folder path location was not found, execute error*
' * messages. *
' *-------------------------------------------------------*
' *
If fFolderNotFND = "Y" Then
GoTo NoPathFound
Else
If fFolderNotFND = "N" Then
fFolderNotFND = "C"
Exit Sub
End If
End If
' *--------------------------------------*
' * Cleanup on exit. *
' *--------------------------------------*
' *
CleanUp:
On Error Resume Next
If fFolderNotFND = "Y" Then
Me.Show
End If
Exit Sub
' *-------------------------------------------------------*
' * Generate message for paths not found. *
' *-------------------------------------------------------*
' *
NoPathFound:
MsgBox pathName _
& vbCrLf _
& "Path Location: " & fFolder _
& vbCrLf _
& vbCrLf _
& "Please check the specified folder path!!", _
vbOKOnly
GoTo CleanUp
Exit Sub
' *-----------------------------*
' * Generate error number and *
' * message. *
' *-----------------------------*
' *
ErrorHandler:
MsgBox Err.Source & " - " _
& Err.Number & ": " & Err.Description, _
vbCritical, "Failure in Accept() UserForm"
Resume CleanUp
End Sub
Has anyone had this issue before? Any help would be appreciated!!
Thanks!