Georgem106
New Member
- Joined
- Jun 12, 2015
- Messages
- 7
Hi. I had to move my Excel Workbook to be incorporated with SharePoint. I have the excel vba code listed below and I copied the link to the SharePoint Library where the main folder xxxxx Document Files, exists.
When I execute the vba, I get the error shown in the attached image.
After numerous searches and changes, I am still getting the error.
Using an Immediate window, the path is created correctly but when it hits Sharepoint for the folder creation, it errors out.
Another Sub will open the existing folder, that was dropped into SharePoint, so the communication exists.
Could it be some SharePoint permission thing since vba is involved, or what am I missing in the code?
Any help will be greatly appreciated.
Sub MakeMyFolder()
Dim fdObj As Object
Dim C As String
Dim P As String
Dim File As String
Application.ScreenUpdating = False
C = Left(Data_UF.Txt_Case_Number.Text, 10)
P = ("https://xxxxxx.sharepoint.com/sites/xxxxx/xxx xxxxx/xxxxx Document Files/" & C)
File = P & C
Set fdObj = CreateObject("Scripting.FileSystemObject")
If fdObj.FolderExists(File) Then
MsgBox "Folder Already Exists.", vbInformation, "Folder Exists"
Else
'Debug.Print File
fdObj.CreateFolder (File)
MsgBox "Folder has been Created.", vbInformation, "Folder Created"
End If
Application.ScreenUpdating = True
End Sub
When I execute the vba, I get the error shown in the attached image.
After numerous searches and changes, I am still getting the error.
Using an Immediate window, the path is created correctly but when it hits Sharepoint for the folder creation, it errors out.
Another Sub will open the existing folder, that was dropped into SharePoint, so the communication exists.
Could it be some SharePoint permission thing since vba is involved, or what am I missing in the code?
Any help will be greatly appreciated.
Sub MakeMyFolder()
Dim fdObj As Object
Dim C As String
Dim P As String
Dim File As String
Application.ScreenUpdating = False
C = Left(Data_UF.Txt_Case_Number.Text, 10)
P = ("https://xxxxxx.sharepoint.com/sites/xxxxx/xxx xxxxx/xxxxx Document Files/" & C)
File = P & C
Set fdObj = CreateObject("Scripting.FileSystemObject")
If fdObj.FolderExists(File) Then
MsgBox "Folder Already Exists.", vbInformation, "Folder Exists"
Else
'Debug.Print File
fdObj.CreateFolder (File)
MsgBox "Folder has been Created.", vbInformation, "Folder Created"
End If
Application.ScreenUpdating = True
End Sub