![]() |
OpenText method - how to check if file exists
Hi,
I am using OpenText method for opening a text file from the Internet location (so the file is something like http://www.x.y/file.txt). Everything is fine except when the file/page is not found I get a message like "could not open ..." that I want to avoid but I don't know how. I have an error handler that deals with it but the message still shows first and the error handler is processed after clicking OK. Is there any way I can avoid the message or check if the file/page exists? thanks very much regards, dejan |
OpenText method - how to check if file exists
Try this:
Sub test() Application.DisplayAlerts = False On Error Resume Next Workbooks.OpenText "http://www.xxxgoogle.co.uk/" Application.DisplayAlerts = True End Sub RBS "Dejan" wrote in message ups.com... Hi, I am using OpenText method for opening a text file from the Internet location (so the file is something like http://www.x.y/file.txt). Everything is fine except when the file/page is not found I get a message like "could not open ..." that I want to avoid but I don't know how. I have an error handler that deals with it but the message still shows first and the error handler is processed after clicking OK. Is there any way I can avoid the message or check if the file/page exists? thanks very much regards, dejan |
OpenText method - how to check if file exists
Great, I didn't even try using DisplayAlerts. It works fine. Thank you
very much regards, dejan RB Smissaert je napisao/la: Try this: Sub test() Application.DisplayAlerts = False On Error Resume Next Workbooks.OpenText "http://www.xxxgoogle.co.uk/" Application.DisplayAlerts = True End Sub RBS "Dejan" wrote in message ups.com... Hi, I am using OpenText method for opening a text file from the Internet location (so the file is something like http://www.x.y/file.txt). Everything is fine except when the file/page is not found I get a message like "could not open ..." that I want to avoid but I don't know how. I have an error handler that deals with it but the message still shows first and the error handler is processed after clicking OK. Is there any way I can avoid the message or check if the file/page exists? thanks very much regards, dejan |
All times are GMT +1. The time now is 07:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com