Guessing Runtime Error in VBA for Excel

  Desert Andy 10:12 11 Mar 2005
Locked

I am writing a program which lets a user press a button and the program automatically saves the Excel workbook to a floppy disc. Although I have promted the used to put a floppy disc into the computer, I would like the program not to crash if he doesn't.
I know the error code will be a runtime error '1004' - Microsoft Office Excel cannot access the file 'A'. Is there any way of telling the program if it gets this code not to crash.

Thanks for your help in advance

  VoG II 10:19 11 Mar 2005

.
Dim oFilesysObject As Object
.
.
.
Set oFilesysObject = CreateObject("SCRIPTING.FILESYSTEMOBJECT")

'Check that drive A is ready

If oFilesysObject.GetDrive("A:\").IsReady = False Then

MsgBox "Drive A is not ready. Please insert a floppy disk."

Exit Sub

End If

  VoG II 10:21 11 Mar 2005

Formatting to pot.

Dim oFilesysObject As Object
.
.
.

Set oFilesysObject = CreateObject("SCRIPTING.FILESYSTEMOBJECT")

'Check that drive A is ready

If oFilesysObject.GetDrive("A:\").IsReady = False Then

MsgBox "Drive A is not ready. Please insert a floppy disk."

Exit Sub

End If

  Desert Andy 10:35 11 Mar 2005

Thanks for your help, swift and correct as always. Very much appreciate your efforts.
Andy

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Android Oreo News: Release Date & New Features

Best Photo Editing Apps for iPad

iMac 21.5-inch (2017) review

Comment regarder le combat entre McGregor et Mayweather ?