Using the Office Object Model
The Office 2003 object library includes a set of objects for working with documents stored in document workspace sites and document libraries. You can use those objects from VBA, Visual Basic .NET, or C#.
The SharePoint objects are connected to the top-level Office document in each application. For example, the following lines each get a reference to the document workspace in Excel, Word, and PowerPoint, respectively, from within VBA:
Set wsXL = ActiveWorkbook.SharedWorkspace
Set wsWord = ActiveDocument.SharedWorkspace
Set wsPPT = ActivePresentation.SharedWorkspaceFrom the document object, the SharePoint objects are organized as shown in Figure 10-1.

Figure 10-1. Office objects for SharePoint Services
From VBA
Use the SharedWorkspace object to create, get, or
delete a SharePoint document workspace site. The technique is the same for any of the
supported document types. For example, to create a new workspace:
Save the document.
Call the
SharedWorkspaceobject'sCreateNewmethod to create the document workspace.Use the document's
SharedWorkspaceobject to add members, tasks, links, files, or folders.
Chapter 5 demonstrates
performing a wide range of SharePoint tasks with an Excel workbook using the SharedWorkspace object in VBA. It also shows how to share
lists between Excel and SharePoint through VBA. Table 10-3 lists frequently asked questions to provide a quick ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access