Network connection handling recommendations

rickblunt

Well-known Member
Joined
Feb 18, 2008
Messages
609
Office Version
  1. 2019
Platform
  1. Windows
Hello, I need to add in some code to one of my projects, but I am not sure what direction to take in regards to handling a nuisance issue with one of my workbooks. I would really appreciate your thoughts on how I should handle it so I know what code I need to try to write up.

The workbook in question makes heavy usage of userforms and subs to do a lot of different functions. All of this works perfectly (thanks to a lot of input from all of you) some of these functions involve auto saves or sending out emails automatically. The network at our plant is pretty solid throughout the site, but occasionally I will see momentary drops in the connections depending on where the user is standing (because of structures or equipment). This is only an issue if the user happens to be triggering a save or an email, so it doesn't happen very often; but when it does it obviously stops the code from running and the user has to restart it.

I know that I could put in a trap to check for the connection before it runs, so that I do not get the macro error; but I am thinking that if I do that I would lose whatever I happen to have in the email being sent out. I am thinking that I need to check for connection, if it is available then continue the sub. But if its not then hold that value until the connection is re-established and then continue it. This sounds logical but I am thinking that if that is all I did, then none of the other subs would run until the other one is finished. I would like to keep on using the workbook while it is waiting for the connection to regained.

Am I thinking correctly? I am struggling on a way to create a "buffer" to hold these actions until the connection is restored while still running all of the other subs. The data for the email is in a userform itself, so I believe that I can keep that form active while the other stuff is running. Maybe I can use that as my buffer and have it cycle every "X" number of seconds to attempt to run it or something? Perhaps there is not really any way of doing this in VBA, but I appreciate any ideas at all. Thanks,
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,521
Messages
6,125,305
Members
449,218
Latest member
Excel Master

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
Back
Top