In this tutorial I will share a VBA Function (User-Defined Function) that can detect whether if a file is currently opened.
VBA Script
Jun 19, 2019 | Excel, VBA | 4 comments
In this tutorial I will share a VBA Function (User-Defined Function) that can detect whether if a file is currently opened.
Subscribe My YouTube Channel
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Some how this function does not work on network mapped drive.
In our company we have shared drive (say, letter S is shared drive letter for colleagues to share files) and I found this function couldn’t detect opened file under S.
You need to fully qualify the path of your network. S:\ is a mask for the fully qualified path on the network for an example:
S:\[rest of your path goes here] would be the same \\Fwdsem_uwfile55\dpt$\UW\[rest of your path goes here]
To get your company’s full network path go to the window start menu, type CMD then hit enter, with the command window open type in NET USE, you will get a list of all Drive Names with their associated fully qualified network path. This path if the user has access is a path EVERYONE can use on the network, not just those with S:/ mapped to the network path needed.
If it’s network drive should also has address other like path “S:/” so try to find it out.
In my company we use \\xxxx and I use that in my code to save files/open them etc.
It worked very well on my system.
Thank you!!