Problems with sharepoint folder creation

%3CLINGO-SUB%20id%3D%22lingo-sub-1748347%22%20slang%3D%22en-US%22%3EProblems%20with%20sharepoint%20folder%20creation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1748347%22%20slang%3D%22en-US%22%3E%3CP%3EHello%3CBR%20%2F%3EI'm%20trying%20to%20port%20an%20Excel%20document%20with%20VBA%20macros%2C%20which%20I%20had%20developed%20for%20our%20network%20drives%2C%20to%20teams%2Fsharepoint.%3CBR%20%2F%3EI%20am%20automatically%20creating%20folders%20based%20on%20the%20data%20that%20is%20entered.%20Unfortunately%20I%20now%20get%20the%20error%20message%20Runtime%20error%20'52'%3A%20wrong%20file%20name%20or%20number.%3CBR%20%2F%3EHere%20is%20the%20code%20I%20use%20to%20check%20if%20a%20folder%20already%20exists.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3EFunction%20CheckIfFolderExists(ByVal%20folderToCheck%20As%20String)%20As%20String%0A%20%20%20%20CheckIfFolderExists%20%3D%20Dir(folderToCheck%2C%20vbDirectory)%0AEnd%20Function%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EHere%20also%20the%20value%20that%20is%20in%20folderToCheck%3A%26nbsp%3B%22%5C%5Cxxx.sharepoint.com%5Csites%5Cxxx%5CShared%20Documents%5Cxxx%5Cxxx%5C001_01_de_SR_Test%22%3CBR%20%2F%3EWhy%20do%20I%20get%20this%20error%3F%20Do%20I%20perhaps%20make%20an%20error%20with%20the%20slash%20characters%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESeb%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hello
I'm trying to port an Excel document with VBA macros, which I had developed for our network drives, to teams/sharepoint.
I am automatically creating folders based on the data that is entered. Unfortunately I now get the error message Runtime error '52': wrong file name or number.
Here is the code I use to check if a folder already exists.

 

Function CheckIfFolderExists(ByVal folderToCheck As String) As String
    CheckIfFolderExists = Dir(folderToCheck, vbDirectory)
End Function

Here also the value that is in folderToCheck: "\\xxx.sharepoint.com\sites\xxx\Shared Documents\xxx\xxx\001_01_de_SR_Test"
Why do I get this error? Do I perhaps make an error with the slash characters?

 

Thanks in advance

 

Seb

 

0 Replies