Avatar of alanpowell2007
alanpowell2007
Flag for United States of America asked on

Excel Vba Publish filtered data to SharePoint

I am having trying to publish filtered excel (2007) data to sharepoint. I keep getting an error that says that one table can't overlay another. Am I going about selecting the range wrong? Here is the code:

Public Sub PublishList()
' Get the collection of lists for the active sheet
Dim L As ListObjects
Set L = ActiveSheet.ListObjects
' Add a new list
Dim NewList As ListObject
Set NewList = L.Add(xlSrcRange, Range("A13:K29"), , True)
NewList.Name = "Red Team Review Metrics"
' Publish it to a SharePoint site
NewList.Publish Array("http://testdrive.sharepoint.mysite.com/teams/clab/" & "_layouts/viewlsts.aspx?BaseType=0", _
"NewLists "), True
End Sub

Thanks
Microsoft ExcelVisual Basic ClassicMicrosoft SharePoint

Avatar of undefined
Last Comment
alanpowell2007

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
colly92002

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
alanpowell2007

ASKER
Thanks...But maybe I shoulf clarify. I don't understand why I am getting an error on this line:

Set NewList = L.Add(xlSrcRange, Range("A13:K29"), , True)

Before it even gets to the publish line. Also, my workbook is in 2010 format.

Alan
alanpowell2007

ASKER
Thank you, colly92002 Though that is the easiest solution, I didn't want to have to use the add-in. But, as a side note: The add-in has vba code behind that just needs a bit of modification to work perfectly.

Alan
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes