Path Exists if shared and comes as \\... not as C:\...

drom

Well-known Member
Joined
Mar 20, 2005
Messages
559
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advance

I am 90% of the time working with folder as follows;
  • C::\Users\My Name\...
  • X:\Files\OBS\...
  • E:\PendingJOBS\Year 2025\...
So it's easy to know y the Path exists
VBA Code:
Function Fx_bFolderExists(wPath As String) As Boolean
  On Error Resume Next:   Application.ScreenUpdating = False
Dim X As String:          X = GetAttr(wPath) And 0
                          If Err = 0 Then Fx_bFolderExists = True                          
End Function
  • From the inmediate window If I put:
    • ? Fx_bFolderExists("C::\Users\My Name\")
    • ? Fx_bFolderExists("C::\Users\My Name")
    • ? Fx_bFolderExists("X:\Files\OBS\")
    • ? Fx_bFolderExists("X:\Files\OBS")
      • I will get True (in all of them because the foders are in my computer, they Exist)

  • From the inmediate window If I put_
    • ? Fx_bFolderExists("C::\Users\My\")
      • I will get False (because this folder or Path does not exist in my PC


During the last month I have received a few requests asking my to do a looping with Files shared in a folder
  • I did not have probles before

But some of the customers can't put this place, this Folders in their PC inside say (C; or D: )
So when they save a file in their C: the file is updated as well in the Shared place


They are working with something that comes as
  • \\srv-dc01\SCompanyName\jobs\Files\
How can I know if a folder exists in the file comes with the address:
  • \\,,,
  • And check for the files inside
Thanks again
 
I guess I didn't understand your question correctly, because my answer is: in the same way.

I quickly tested your function on my local network and I think it worked as expected.
VBA Code:
? Fx_bFolderExists("\\192.168.0.101\AsK\Katja\Camera\20140430_220129.jpg")
True

Is it not working in your environment or is there some other problem?

My apologies for any quirks, English is not my native language. "So I blame Google translate for all my goofs." :devilish:
 
Upvote 0

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