Error Handling for not finding network address? ...ignore without popup.

chuggins143

Board Regular
Joined
Nov 10, 2009
Messages
90
Hello all,

I have a macro that will go out to a text file on our server and retrieve some data... obviously, it works fine when I'm connected, but if I lose connection with the server then I get a window that says... "Sorry, we couldn't find 'file address'. Is it possible it was moved, renamed, or deleted?" I'd like to automate the sheet so that it'll run the macro every few min, but ignore the error if it loses connection. Anyone have a suggestion on how to have my code ignore this error?

TIA,

Chad
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

jsb1921

Board Regular
Joined
Aug 14, 2020
Messages
70
Office Version
  1. 2007
Platform
  1. Windows
  2. Web
VBA Code:
On error resume next
----open the file --
if err.number <> 0 then
   exit sub
else
    -- process your task  --
end if
 
Solution

chuggins143

Board Regular
Joined
Nov 10, 2009
Messages
90
JSB, Thank you for the response!

I did have to add the following at the top of my sub to get the popup to stop too...

Application.DisplayAlerts = False

The combination of these seems to have stopped the annoying popup I was getting... the first time it goes and tries to find it takes a few seconds, but once the computer realizes that it can't get to the server then it's virtually instantaneous.

Thanks!

Chad
 

Watch MrExcel Video

Forum statistics

Threads
1,129,735
Messages
5,638,057
Members
417,001
Latest member
MSteel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top