none
Is it possible to create list item in SharePoint 2010 using a macro RRS feed

  • Question

  • Hi All,

    Is it possible to create list item in SharePoint 2010 using a macro. I want to populate data (excel rows) into SharePoint 2010 list using a macro on button click.

    Thanks in advance..!!
    Ankit

    Thursday, October 29, 2015 2:15 PM

Answers

  • Hi Ankit,

    Yes, you could create list in SharePoint from excel with macro. Here is the steps.

    1. Enter data with headings in excel sheet
    2.  Format the data as table with checking “My table has headers”
    3. Click->Design->Export->Export Table to SharePoint List

    Here is a simple macro code:

    Sub Macro1()
        Range("A1:B10").Select
        ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$B$10"), , xlYes).Name = _
            "Table2"
        Range("Table2[#All]").Select
        ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleLight1"
        ActiveSheet.ListObjects("Table2").Publish Array( _
            "https://your site Url", "ExcelTable"), False
        Range("Table2[#All]").Select
    End Sub

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, October 30, 2015 2:34 AM