Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle open file errors in code?
I've got an excel workbook that opens another file using:
On Error GoTo Missing Workbooks.Open Filename:=fn, UpdateLinks:=False, ReadOnly:=True When the file can't be opened, I'd like the code to handle the situation. However, if the file can't be open, the user still gets a pop-up saying the file can't be opened, do you want to continue? Is there any way to supress that message to the user? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle open file errors in code?
Dim wbkOpen As Workbook
On Error Resume Next Set wbkOpen = Workbooks.Open(Filename:=fn, UpdateLinks:=False, _ ReadOnly:=True) On Error GoTo 0 If wbkOpen Is Nothing Then If MsgBox("file did not open. continue?", vbYesNo) = vbNo Then MsgBox "All done" Else MsgBox "Keep on going" End If End If -- HTH... Jim Thomlinson "M. Brane" wrote: I've got an excel workbook that opens another file using: On Error GoTo Missing Workbooks.Open Filename:=fn, UpdateLinks:=False, ReadOnly:=True When the file can't be opened, I'd like the code to handle the situation. However, if the file can't be open, the user still gets a pop-up saying the file can't be opened, do you want to continue? Is there any way to supress that message to the user? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. | Excel Discussion (Misc queries) | |||
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. | Setting up and Configuration of Excel | |||
Error Handle: File is already open. | Excel Programming | |||
Handle Compile Errors | Excel Programming | |||
REPOST: How to handle errors | Excel Programming |