ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disabling the "could not open" notification (https://www.excelbanter.com/excel-programming/355752-disabling-could-not-open-notification.html)

Alfredo

Disabling the "could not open" notification
 
Sorry, I have looked extensively but could not find this on my own.

In VBA code:

1) Is there a way of disabling the notification that Excel was not able to
open a file?

And to try to kill two birds with one stone:

2) Is there similary a way of also disabling the window that tells you it is
(trying to / in the process of) opening a file

Thanks
Alfredo


Ardus Petus

Disabling the "could not open" notification
 
1) Use On Error

on error resume next
set myWS = Workbooks.Open("MyFile.xls")
on error goto 0
if myWS is nothing then
msgbox "File not found"
exit sub
end if

2)
Didn't understand the question

HTH
--
AP




Alfredo

Disabling the "could not open" notification
 
Thanks.

I will use that, and/or a combination with:

Application.DisplayAlerts = False
Application.DisplayAlerts = True

... which I only just discovered.


"Ardus Petus" wrote:

1) Use On Error

on error resume next
set myWS = Workbooks.Open("MyFile.xls")
on error goto 0
if myWS is nothing then
msgbox "File not found"
exit sub
end if

2)
Didn't understand the question

HTH
--
AP






All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com