I'm using this in Excel (Excel 2010 currently).
Trying to use Excel to copy a file from one folder at one network location to multiple other network locations.
Ever so often, I'll come across network paths (target paths) that are unreachable because: The computer is turned off or perhaps there's some technical issue at that machine.
What I want to do is to build a script to run through a list of folder addresses, copying the same file to the folders. However, I've noticed that when just testing opening a link to a folder that doesn't currently exist (probably, the computer is turned off, or else it could be an old computer taken off the system, but the list not yet updated). When I click on a link for it or else if I run the Dir() function to test whether the file is there, Excel (running this currently in Excel in my testing) will sit and spin for way too long of a time before failing. I'd rather it fail within a second or two if possible, and then move on.
My question is: is there an easy way to force the time to assume failure to be much shorter than it apparently is?
So far I've tested 2 things:
1. Actually clicking a link to a folder I know is not currently available to the network (this is a link to a folder, not file)
2. Using the Dir() function in a short procedure to see if it'd fail more quickly when looking at the same linked folder. (This gives error 52: Bad file name or number)
Test VBA code:
Thanks for any thoughts.
"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
Trying to use Excel to copy a file from one folder at one network location to multiple other network locations.
Ever so often, I'll come across network paths (target paths) that are unreachable because: The computer is turned off or perhaps there's some technical issue at that machine.
What I want to do is to build a script to run through a list of folder addresses, copying the same file to the folders. However, I've noticed that when just testing opening a link to a folder that doesn't currently exist (probably, the computer is turned off, or else it could be an old computer taken off the system, but the list not yet updated). When I click on a link for it or else if I run the Dir() function to test whether the file is there, Excel (running this currently in Excel in my testing) will sit and spin for way too long of a time before failing. I'd rather it fail within a second or two if possible, and then move on.
My question is: is there an easy way to force the time to assume failure to be much shorter than it apparently is?
So far I've tested 2 things:
1. Actually clicking a link to a folder I know is not currently available to the network (this is a link to a folder, not file)
2. Using the Dir() function in a short procedure to see if it'd fail more quickly when looking at the same linked folder. (This gives error 52: Bad file name or number)
Test VBA code:
Code:
Sub TestDirectory()
Debug.Print Dir("\\MyNetworkFolderPath", vbDirectory)
End Sub
Thanks for any thoughts.
"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57