Someone else asked a similar but distinct question. But their methods did not work for me.
I am writing a Sub to iterate over a list, turning the plaintext into hyperlinks based on the cell contents. It just appends the String "CellContents" to the end of a Constant "MyPath".
I wrote an If statement to make the linked directory if it doesn't exist, but I am getting myriad errors when I introduce it. The usual one at the moment is "Error 76: path not found".
Path = Trim(MyPath & CellContents & "\")
If Dir(Path, vbDirectory) = "" Then
Call MkDir(Path)
End If
I've also tried
If Dir(Path, vbDirectory) = "" Then
MkDir Path
End If
I know for certain that the containing folder exists, and I've tried using Call MkDir and MkDir alone. I've also tried Trim()/no Trim() on Path, which does not solve it (and the inputs are strings so Str() causes its own error). I've also tried Len(Dir(Path)=0 in the conditional, none of which helps MkDir recognize that Path is a valid path! Why is it not being recognized correctly?