Hi All,
I have a problem with the CDI Save As box.
I have inserted an errorhandler to capture the Cancel button, telling the user they MUST enter a filename and returning (by GoTo) to above the part (in code) where the Dialog box is shown.
Problem is, if the user presses Cancel for a second time, the errorhandler no longer captures the error, instead giving me the Runtime error that Cancel was Selected.
WHERE AM I GOING WRONG?????
Heres the code...
[tt]
'Initialise Error Handler
On Error GoTo ErrorHandler
---More Code---
ReSave:
With cdiMain
.DialogTitle = "Save New Insomniac CD"
.InitDir = App.Path & "\Library"
.Filter = "Insomniac Files|*.inm"
.Filename = UserFile 'USERFILE VARIABLE DEFAULT
.CancelError = True
.ShowSave
If Trim(.Filename) <> "" Then
TrackFilename = .Filename
txtDetails(4).Text = .Filename
CDFilename = Mid(.Filename, 1, Len(.Filename) - 4) & ".cdi"
Filenum = FreeFile
'Create Trackfile
Open TrackFilename For Random As Filenum Len = Len(Trax)
Close Filenum
Filenum = FreeFile
'Create CD File
Open CDFilename For Random As Filenum Len = Len(CD)
Close Filenum
'Create MasterFile
Open App.Path & "\insomniac.inm" For Random As Filenum Len = Len(Files)
Files.CDFile = Trim(CDFilename)
Files.Trackfile = Trim(TrackFilename)
Put Filenum, 1, Files
Close Filenum
Else
MsgBox "Invalid Filename"
End If
End With
---More Code--
Exit Sub
ErrorHandler:
If Err.Number = cdlCancel Then
MsgBox "You Must Enter a New Filename", vbExclamation + vbOKOnly, "Save Error"
GoTo ReSave
Else
msgString = "An Error Has Occured While Saving The File, If this occurs again, Contact Technical Support" + vbLf + "Error Number : " & Err.Number & " (" & Err.Description & "
"
MsgBox msgString, vbOKOnly + vbExclamation, "Save Error"
Resume Next
End If
[/tt]
Sorry for the untidiness
Thanks in Advance.
¥oshi ![[yinyang] [yinyang] [yinyang]](/data/assets/smilies/yinyang.gif)
-------------------------
"There is No Spoon.."
-------------------------
Programming Outsource:
I have a problem with the CDI Save As box.
I have inserted an errorhandler to capture the Cancel button, telling the user they MUST enter a filename and returning (by GoTo) to above the part (in code) where the Dialog box is shown.
Problem is, if the user presses Cancel for a second time, the errorhandler no longer captures the error, instead giving me the Runtime error that Cancel was Selected.
WHERE AM I GOING WRONG?????
Heres the code...
[tt]
'Initialise Error Handler
On Error GoTo ErrorHandler
---More Code---
ReSave:
With cdiMain
.DialogTitle = "Save New Insomniac CD"
.InitDir = App.Path & "\Library"
.Filter = "Insomniac Files|*.inm"
.Filename = UserFile 'USERFILE VARIABLE DEFAULT
.CancelError = True
.ShowSave
If Trim(.Filename) <> "" Then
TrackFilename = .Filename
txtDetails(4).Text = .Filename
CDFilename = Mid(.Filename, 1, Len(.Filename) - 4) & ".cdi"
Filenum = FreeFile
'Create Trackfile
Open TrackFilename For Random As Filenum Len = Len(Trax)
Close Filenum
Filenum = FreeFile
'Create CD File
Open CDFilename For Random As Filenum Len = Len(CD)
Close Filenum
'Create MasterFile
Open App.Path & "\insomniac.inm" For Random As Filenum Len = Len(Files)
Files.CDFile = Trim(CDFilename)
Files.Trackfile = Trim(TrackFilename)
Put Filenum, 1, Files
Close Filenum
Else
MsgBox "Invalid Filename"
End If
End With
---More Code--
Exit Sub
ErrorHandler:
If Err.Number = cdlCancel Then
MsgBox "You Must Enter a New Filename", vbExclamation + vbOKOnly, "Save Error"
GoTo ReSave
Else
msgString = "An Error Has Occured While Saving The File, If this occurs again, Contact Technical Support" + vbLf + "Error Number : " & Err.Number & " (" & Err.Description & "
MsgBox msgString, vbOKOnly + vbExclamation, "Save Error"
Resume Next
End If
[/tt]
Sorry for the untidiness
Thanks in Advance.
![[yinyang] [yinyang] [yinyang]](/data/assets/smilies/yinyang.gif)
![[yinyang] [yinyang] [yinyang]](/data/assets/smilies/yinyang.gif)
-------------------------
"There is No Spoon.."
-------------------------
Programming Outsource: