Insert row into Sharepoint List Error

tez_field

Board Regular
Joined
Apr 22, 2009
Messages
60
Hi,

I am attempting to create a form that for time and complexitys sake I am not using Infopath, and have got to the point where I need my excel spreadsheet to write its' form fields to a sharepoint list. I have the code below to do this:

Code:
Public Function uploadForm()


' Get the collection of lists for the active sheet
Dim L As ListObjects
Set L = Worksheets("Upload").ListObjects


' Add a new list
Dim NewList As ListObject


Worksheets("Upload").ListObjects("Form").Unlist


'Set NewList = L.Add(xlSrcRange, Range("A14,J50").CurrentRegion, , xlYes)
Set NewList = L.Add(xlSrcRange, Worksheets("Upload").Range("Upload"), xlYes)




NewList.Name = "Form"


' Publish it to my SharePoint list
NewList.Publish Array("http://teamsites.ds-s.com/sites/SDS/_layouts/viewlsts.aspx?BaseType=0", "FlagOrders "), True


End Function

The error I am receiving is:
Run-time Error '-2147024809 (80070057)':
Cannot connect to the server at this time. Your table cannot be published.

I have seen in other code online that people include a space character after their list name in the publish command, but I have tried it with and without and the same error occurs.

Any help with this or any other suggestions would be great!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,529
Messages
6,125,344
Members
449,219
Latest member
Smiqer

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