Orin Moyer
Orin Moyer

Reputation: 509

VBA MKDIR in SharePoint fails

Here is my issue:

I am trying to make a folder in a SharePoint shared document library. But it only works after I enter my credentials using the "open with windows explorer" menu item.

My users will not understand if I tell them they need to do this first. So, my questions is either: (A) is there a way to force this credential popup from VBA OR... (B) is there a way to pass these credentials through VBA

myWorkbookBasePath= "\\sharepoint.buckeye.com\sites\transportation\cc\pipelineoperationreports\Shared%20Documents\" & folder


MkDir myWorkbookBasePath

enter image description here

Upvotes: 3

Views: 4830

Answers (1)

Bond
Bond

Reputation: 16311

What credentials would you use if you could provide them programmatically? If you can answer that, you could try something like this:

Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "Z:", "\\server\share", False, strUser, strPwd

MkDir "Z:\NewFolder"
...
objNetwork.RemoveNetworkDrive "Z:"

Upvotes: 5

Related Questions