We help IT Professionals succeed at work.
Troubleshooting Question

How to Publish a list to SharePoint using VBA in Access

41 Views
Last Modified: 2020-10-27
I have a remote site that uses one of my applications and they asked for some changes.  One of those changes required a new SharePoint list.  Without going into detail they don't have the expertise to create the list.  I know how I can do this via Excel using the code below:
Function Publish_List()
Dim spList As ListObjects
Dim NewSPList As ListObject
Set spList = ActiveSheet.ListObjects
Set NewSPList = spList.Add(xlsrcRange, Range("A1:A16"), True, xlYes)
NewSPList.Name = "tblEmployeeAIS"
NewSPList.Publish Array("SharepointName", NewSPList.Name), True

End Function
However, I have no idea how to do that from Access.  I was thinking the transferdatabase option but I am not sure that is the best option.  

Is there a better way and if so how?

J
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
John SheehySystem Security Manager

Author

Commented:
I will let you know today if that work.  Thank you.
John SheehySystem Security Manager

Author

Commented:
Just curious about the WSS option.  I have not seen that used with TransferDatabase before.  What is it for?
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
It is for exactly what you ask for - though one has to know, as the docs don't explain:

DoCmd.TransferDatabase method (Access)
John SheehySystem Security Manager

Author

Commented:
That is extremely helpful.  Thank you.
John SheehySystem Security Manager

Author

Commented:
Gutav,

Your solution was tested with 27 tables and everything worked with out an issue and it was way faster then the export option.  Thank you very much,

John
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Great! Thanks for the feedback.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions