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,
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,