Creates a new reference (a String value) to an Answer Wizard file and adds it to the AnswerWizardFiles collection.
expression.Add(FileName)
expression Required. An expression that returns an AnswerWizardFiles collection.
FileName Required String. The fully qualified path to the specified Answer Wizard file.
Add method as it applies to the CommandBars object.
Creates a new command bar and adds it to the collection of command bars. Returns a CommandBar object.
expression.Add(Name, Position, MenuBar, Temporary)
expression Required. An expression that returns a CommandBars object.
Name Optional Variant. The name of the new command bar. If this argument is omitted, a default name is assigned to the command bar (such as Custom 1).
Position Optional Variant. The position or type of the new command bar. Can be one of the MsoBarPosition constants listed in the following table.
Constant | Description |
---|---|
msoBarLeft, msoBarTop, msoBarRight, msoBarBottom | Indicates the left, top, right, and bottom coordinates of the new command bar |
msoBarFloating | Indicates that the new command bar won't be docked |
msoBarPopup | Indicates that the new command bar will be a shortcut menu |
msoBarMenuBar | Macintosh only |
MenuBar Optional Variant. True to replace the active menu bar with the new command bar. The default value is False.
Temporary Optional Variant. True to make the new command bar temporary. Temporary command bars are deleted when the container application is closed. The default value is False.
Add method as it applies to the CommandBarControls object.
Creates a new CommandBarControl object and adds it to the collection of controls on the specified command bar.
expression.Add(Type, Id, Parameter, Before, Temporary)
expression Required. An expression that returns a CommandBarControls object.
Type Optional Variant. The type of control to be added to the specified command bar. Can be one of the following MsoControlType constants: msoControlButton, msoControlEdit, msoControlDropdown, msoControlComboBox, or msoControlPopup.
Id Optional Variant. An integer that specifies a built-in control. If the value of this argument is 1, or if this argument is omitted, a blank custom control of the specified type will be added to the command bar.
Parameter Optional Variant. For built-in controls, this argument is used by the container application to run the command. For custom controls, you can use this argument to send information to Visual Basic procedures, or you can use it to store information about the control (similar to a second Tag property value).
Before Optional Variant. A number that indicates the position of the new control on the command bar. The new control will be inserted before the control at this position. If this argument is omitted, the control is added at the end of the specified command bar.
Temporary Optional Variant. True to make the new control temporary. Temporary controls are automatically deleted when the container application is closed. The default value is False.
Add method as it applies to the DocumentProperties object.
Creates a new custom document property. You can only add a new document property to the custom DocumentProperties collection.
expression.Add(Name, LinkToContent, Type, Value, LinkSource)
expression Required. The custom DocumentProperties object.
Name Required String. The name of the property.
LinkToContent Required Boolean. Specifies whether the property is linked to the contents of the container document. If this argument is True, the LinkSource argument is required; if it's False, the value argument is required.
Type Optional Variant. The data type of the property. Can be one of the following MsoDocProperties constants: msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat, msoPropertyTypeNumber, or msoPropertyTypeString.
Value Optional Variant. The value of the property, if it's not linked to the contents of the container document. The value is converted to match the data type specified by the type argument, if it can't be converted, an error occurs. If LinkToContent is True, the Value argument is ignored and the new document property is assigned a default value until the linked property values are updated by the container application (usually when the document is saved).
LinkSource Optional Variant. Ignored if LinkToContent is False. The source of the linked property. The container application determines what types of source linking you can use.
Remarks
If you add a custom document property to the DocumentProperties collection that’s linked to a given value in a Microsoft Office document, you must save the document to see the change to the DocumentProperty object.
Add method as it applies to the FileDialogFilters object.
Adds a new file filter to the list of filters in the Files of type drop down list box in the File dialog box. Returns a FileDialogFilter object that represents the newly added file filter.
expression.Add(Description, Extensions, Position)
expression Required. An expression that returns one of the above objects.
Description Required String. The text representing the description of the file extension you want to add to the list of filters.
Extensions Required String. The text representing the file extension you want to add to the list of filters. More than one extension may be specified and each must be separated by a semi-colon (;). For example, the Extensions argument can be assigned to the string: "*.txt; *.htm". Note Parentheses do not need to be added around the extensions. Office will automatically add parentheses around the extensions string when the description and extensions strings are concatenated into one file filter item.
Position Optional Variant. A number that indicates the position of the new control in the filter list. The new filter will be inserted before the filter at this position. If this argument is omitted, the filter is added at the end of the list.
Remarks
Each filter in a list is made up of two parts: the file extension (e.g. .txt) and the text description of the file extension (e.g. Text Files). Together, the file filter would appear in the Files of type drop down list box as: Text Files (*.txt).
Note that when a filter is added to the list, the default filters are not removed.
Filters are only displayed when the Windows option is checked.
If Position is invalid, an out of range runtime error is displayed. If the Description and Extensions value are invalid, a runtime error (parse) is displayed.
Folder picker dialogs do not have filters, therefore, filter methods do not apply to the folder picker.Add method as it applies to the FileTypes object.
Adds a new file type to a file search.
expression.Add(FileType)
expression Required. An expression that returns one of the above objects.
FileType Required MsoFileType. Specifies the type of file for which to search.
MsoFileType can be one of these MsoFileType constants. |
msoFileTypeAllFiles |
msoFileTypeBinders |
msoFileTypeCalendarItem |
msoFileTypeContactItem |
msoFileTypeCustom |
msoFileTypeDatabases |
msoFileTypeDataConnectionFiles |
msoFileTypeDesignerFiles |
msoFileTypeDocumentImagingFiles |
msoFileTypeExcelWorkbooks |
msoFileTypeJournalItem |
msoFileTypeMailItem |
msoFileTypeNoteItem |
msoFileTypeOfficeFiles |
msoFileTypeOutlookItems |
msoFileTypePhotoDrawFiles |
msoFileTypePowerPointPresentations |
msoFileTypeProjectFiles |
msoFileTypePublisherFiles |
msoFileTypeTaskItem |
msoFileTypeTemplates |
msoFileTypeVisioFiles |
msoFileTypeWebPages |
msoFileTypeWordDocuments |
Add method as it applies to the PropertyTests object.
Adds a PropertyTest object to the PropertyTests collection.
expression.Add(Name, Condition, Value, SecondValue, Connector)
expression Required. An expression that returns a PropertyTests object.
Name Required String. The name of the property criterion. The name corresponds to a value in the Property box in the Find dialog box, which you open from the Tools menu in the application's Open dialog box (File menu).
Condition Required MsoCondition. The condition of the search criteria.
MsoCondition can be one of these MsoCondition constants. |
msoConditionAnyNumberBetween |
msoConditionAnytime |
msoConditionAnytimeBetween |
msoConditionAtLeast |
msoConditionAtMost |
msoConditionBeginsWith |
msoConditionDoesNotEqual |
msoConditionEndsWith |
msoConditionEquals |
msoConditionEqualsCompleted |
msoConditionEqualsDeferred |
msoConditionEqualsHigh |
msoConditionEqualsInProgress |
msoConditionEqualsLow |
msoConditionEqualsNormal |
msoConditionEqualsNotStarted |
msoConditionEqualsWaitingForSomeoneElse |
msoConditionFileTypeAllFiles |
msoConditionFileTypeBinders |
msoConditionFileTypeCalendarItem |
msoConditionFileTypeContactItem |
msoConditionFileTypeDatabases |
msoConditionFileTypeDataConnectionFiles |
msoConditionFileTypeDesignerFiles |
msoConditionFileTypeDocumentImagingFiles |
msoConditionFileTypeExcelWorkbooks |
msoConditionFileTypeJournalItem |
msoConditionFileTypeMailItem |
msoConditionFileTypeNoteItem |
msoConditionFileTypeOfficeFiles |
msoConditionFileTypeOutlookItems |
msoConditionFileTypePhotoDrawFiles |
msoConditionFileTypePowerPointPresentations |
msoConditionFileTypeProjectFiles |
msoConditionFileTypePublisherFiles |
msoConditionFileTypeTaskItem |
msoConditionFileTypeTemplates |
msoConditionFileTypeVisioFiles |
msoConditionFileTypeWebPages |
msoConditionFileTypeWordDocuments |
msoConditionFreeText |
msoConditionIncludes |
msoConditionIncludesFormsOf |
msoConditionIncludesNearEachOther |
msoConditionIncludesPhrase |
msoConditionInTheLast |
msoConditionInTheNext |
msoConditionIsExactly |
msoConditionIsNo |
msoConditionIsNot |
msoConditionIsYes |
msoConditionLastMonth |
msoConditionLastWeek |
msoConditionLessThan |
msoConditionMoreThan |
msoConditionNextMonth |
msoConditionNextWeek |
msoConditionNotEqualToCompleted |
msoConditionNotEqualToDeferred |
msoConditionNotEqualToHigh |
msoConditionNotEqualToInProgress |
msoConditionNotEqualToLow |
msoConditionNotEqualToNormal |
msoConditionNotEqualToNotStarted |
msoConditionNotEqualToWaitingForSomeoneElse |
msoConditionOn |
msoConditionOnOrAfter |
msoConditionOnOrBefore |
msoConditionThisMonth |
msoConditionThisWeek |
msoConditionToday |
msoConditionTomorrow |
msoConditionYesterday |
Value Optional Variant. The value of the search criterion.
SecondValue Optional Variant. An upper value for the search range. You can use this argument only if Condition is msoConditionAnyTimeBetween or msoConditionAnyNumberBetween.
Connector Optional MsoConnector. Specifies the way two search criteria are combined.
MsoConnector can be one of these MsoConnector constants. |
msoConnectorAnd default |
msoConnectorOr |
Add method as it applies to the NewFile object.
Adds a new item to the New Item task pane. Returns a Boolean. True if the item was successfully added.
expression.Add(FileName, Section, DisplayName, Action)
expression Required. An expression that returns one of the above objects.
FileName Required String. The name of the file to add to the list of files on the task pane.
Section Optional Variant. The section to which to add the file. Can be any msoFileNewSection constant.
DisplayName Optional Variant. The text to display in the task pane.
Action Optional Variant. The action to take when a user clicks on the item. Can be any msoFileNewAction constant.
Add method as it applies to the ODSOFilters object.
Adds a new filter to the ODSOFilters collection.
expression.Add(Column, Comparison, Conjunction, bstrCompareTo, DeferUpdate)
expression Required. An expression that returns one of the above objects.
Column Required String. The name of the table in the data source.
Comparison Required MsoFilterComparison. How the data in the table is filtered.
MsoFilterComparison can be one of these MsoFilterComparison constants. |
msoFilterComparisonContains |
msoFilterComparisonEqual |
msoFilterComparisonGreaterThan |
msoFilterComparisonGreaterThanEqual |
msoFilterComparisonIsBlank |
msoFilterComparisonIsNotBlank |
msoFilterComparisonLessThan |
msoFilterComparisonLessThanEqual |
msoFilterComparisonNotContains |
msoFilterComparisonNotEqual |
Conjunction Required MsoFilterConjunction. Determines how this filter relates to other filters in the ODSOFilters object.
MsoFilterConjunction can be one of these MsoFilterConjunction constants. |
msoFilterConjunctionAnd |
msoFilterConjunctionOr |
bstrCompareTo Optional String. If the Comparison argument is something other than msoFilterComparisonIsBlank or msoFilterComparisonIsNotBlank, a string to which the data in the table is compared.
DeferUpdate Optional Boolean. Default is False.
Add method as it applies to the Permission object.
Creates a new set of permissions on the active document for the specified user. Returns a UserPermission object.
expression.Add(UserID, Permission, ExpirationDate)
expression Required. An expression that returns a Permission object.
UserID Required String. The email address (in the format [email protected]) of the user to whom permissions on the active document are being granted.
Permission Optional msoPermission. The permissions on the active document that are being granted to the specified user.
MsoPermission can be one or a combination of these MsoPermission constants. |
msoPermissionChange |
msoPermissionEdit |
msoPermissionExtract |
msoPermissionFullControl |
msoPermissionObjModel |
msoPermissionPrint |
msoPermissionRead |
msoPermissionSave |
msoPermissionView |
ExpirationDate Optional Date. The expiration date for the permissions that are being granted.
Add method as it applies to the Scripts object.
Adds a Script object to the Scripts collection of one of the following objects: a Document or Range object in Microsoft Word; a Worksheet or Chart object in Microsoft Excel; or a Slide, SlideRange, slide Master, or title Master object in Microsoft PowerPoint. Returns a Script object.
expression.Add(Anchor, Location, Language, Id, Extended, ScriptText)
expression Required. The Scripts collection.
Anchor Optional Range (Microsoft Excel only). The Anchor argument accepts an Excel Range object, which specifies the placement of the script anchor on an Excel Worksheet. You cannot insert script anchors into Excel charts.
Location Optional MsoScriptLocation. Specifies the location of the script anchor in a document. If you’ve specified the Anchor argument, the Location argument isn’t used; the location of the Anchor argument determines the location of the script anchor.
MsoScriptLocation can be one of these MsoScriptLocation constants. |
msoScriptLocationInBody default |
msoScriptLocationInHead |
Language Optional MsoScriptLanguage. Specifies the script language.
MsoScriptLanguage can be one of these MsoScriptLanguage constants. |
msoScriptLanguageASP |
msoScriptLanguageJava |
msoScriptLanguageOther |
msoScriptLanguageVisualBasic default |
Id Optional String. The ID of the <SCRIPT> tag in HTML. The Id argument specifies an SGML identifier used for naming elements. Valid identifiers include any string that begins with a letter and is composed of alphanumeric characters; the string can also include the underscore character ( _ ). The ID must be unique within the HTML document. This parameter is exported as the ID attribute in the <SCRIPT> tag.
Extended Optional String. Specifies attributes that are to be added to the <SCRIPT> tag (LANGUAGE and ID attributes are exported through the Language and Id parameters and should not be exported through the Extended parameter). The default is the empty string. Attributes are separated by spaces, the same as in HTML. The Microsoft Office host application doesn’t provide any means of checking the syntax of passed attributes.
ScriptText Optional String. Specifies the text contained in a block of script. The default is the empty string. The Microsoft Office host application doesn’t check the syntax of the script.
Remarks
A shape associated with a script block isn’t exported or printed as a shape in HTML; only the script block gets exported.
You cannot use the Add method to add a script anchor to a PowerPoint slide range that contains more than one slide.
Add method as it applies to the SearchFolders object.
Adds a search folder to a file search.
expression.Add(ScopeFolder)
expression Required. An expression that returns one of the above objects.
ScopeFolder Required ScopeFolder object. The folder to add to the search.
Add method as it applies to the SignatureSet object.
Returns a Signature object that represents a new e-mail signature.
expression.Add
expression Required. An expression that returns one of the above objects.
Add method as it applies to the SharedWorkspaceFiles object.
Adds a file to the document library in a shared workspace. Returns a SharedWorkspaceFile object.
expression.Add(FileName, ParentFolder, OverwriteIfFileAlreadyExists, KeepInSync)
expression Required. An expression that returns a SharedWorkspaceFiles object.
FileName Required String. The path and filename of the file to be added to the current shared workspace.
ParentFolder Optional SharedWorkspaceFolder. The subfolder in which to place the file, if not the main document library folder within the shared workspace. Add the file to the main document library folder by leaving this optional argument empty.
OverwriteIfFileAlreadyExists Optional Boolean. True to overwrite an existing file by the same name. Default is False.
KeepInSync Optional Boolean. True to keep the local copy of the document synchronized with the copy in the shared workspace. Default is False.
Add method as it applies to the SharedWorkspaceFolders object.
Adds a folder to the document library in a shared workspace. Returns a SharedWorkspaceFolder object.
expression.Add(FolderName, ParentFolder)
expression Required. An expression that returns a SharedWorkspaceFolders object.
FolderName Required String. The name of the folder to be added to the current shared workspace.
ParentFolder Optional SharedWorkspaceFolder. The subfolder in which to place the new folder, if not the main document library folder within the shared workspace. Add the folder to the main document library folder by leaving this optional argument empty.
Add method as it applies to the SharedWorkspaceLinks object.
Adds a link to the list of links in a shared workspace. Returns a SharedWorkspaceLink object.
expression.Add(URL, Description, Notes)
expression Required. An expression that returns a SharedWorkspaceLinks object.
URL Required String. The URL of the web site to which a link is being added.
Description Optional String. Optional description of the link.
Notes Optional String. Optional notes about the link.
Add method as it applies to the SharedWorkspaceMembers object.
Adds a member to the list of members in a shared workspace. Returns a SharedWorkspaceMember object.
expression.Add(Email, DomainName, DisplayName, Role)
expression Required. An expression that returns a SharedWorkspaceMembers object.
Email Required String. The new member's email address in the format [email protected]. Raises an error if the user is not a valid candidate for membership in the shared workspace.
DomainName Required String. The new member's Windows user name in the format domain\user.
DisplayName Required String. The friendly name to display for the new member.
Role Optional String. An optional role that determines the tasks the new member can accomplish in the shared workspace; for example, "Contributor". An invalid role name raises an error.
Add method as it applies to the SharedWorkspaceTasks object.
Adds a task to the list of tasks in a shared workspace. Returns a SharedWorkspaceTask object.
expression.Add(Title, Status, Priority, Assignee, Description, Due Date)
expression Required. An expression that returns a SharedWorkspaceTasks object.
Title Required String. The title of the new task.
Status Optional msoSharedWorkspaceTaskStatus. The status of the new task. Default is msoSharedWorkspaceTaskStatusNotStarted.
MsoSharedWorkspaceTaskStatus can be one of these msoSharedWorkspaceTaskStatus constants. |
msoSharedWorkspaceTaskStatusComplete |
msoSharedWorkspaceTaskStatusDeferred |
msoSharedWorkspaceTaskStatusInProgress |
msoSharedWorkspaceTaskStatusNotStarted |
msoSharedWorkspaceTaskStatusWaiting |
Priority Optional msoSharedWorkspaceTaskPriority. The priority of the new task. Default is msoSharedWorkspaceTaskPriorityNormal.
MsoSharedWorkspaceTaskPriority can be one of these MsoSharedWorkspaceTaskPriority constants. |
msoSharedWorkspaceTaskPriorityHigh |
MsoSharedWorkspaceTaskPriorityLow |
MsoSharedWorkspaceTaskPriorityNormal |
Assignee Optional SharedWorkspaceMember. The member to whom the new task is assigned.
Description Optional String. The description of the new task.
DueDate Optional Date. The due date of the new task.
Remarks
The schema that defines shared workspace tasks and their properties for a SharePoint Products and Technologies site can be modified on the server in such a way that the Add method of the SharedWorkspaceTasks collection may raise an error, or may disregard the values of certain arguments. In particular, the task status and priority enumerations can be customized. Some examples of the problems that can result are mentioned below:
- If a Status argument is supplied, and the status field has been removed from the customized tasks schema, the argument will be ignored and no error will be raised.
- If a Status value is supplied that lies outside the status values recognized by the customized tasks schema, the argument will be ignored, the default value will be used, and no error will be raised.
- If a new required field has been added to the customized tasks schema, then the Add method will fail with an erro, and it will no longer be possible to use the Add method to add new tasks.
Example
As it applies to the AnswerWizardFiles object.
This example prepares the Answer Wizard to accept a custom file list and adds two custom Answer Wizard files. First, the example clears the file list, and then it adds two custom Answer Wizard files and checks the file count and the file names to ensure that the files were added correctly.
Dim customAnswerWizard As AnswerWizard
Set customAnswerWizard = Application.AnswerWizard
customAnswerWizard.ClearFileList
customAnswerWizard.Files.Add ("c:\awfiles\custom_1.aw")
customAnswerWizard.Files.Add ("c:\awfiles\custom_2.aw")
If customAnswerWizard.Files.Count = 2 Then
MsgBox "Files " & customAnswerWizard.Files.Item(1) & _
" and " & customAnswerWizard.Files(2) & _
" were added sucessfully."
End If
As it applies to the CommandBarControls object.
This example creates a custom editing toolbar that contains buttons (controls) for cutting, copying, and pasting.
Dim customBar As CommandBar
Dim newButton As CommandBarButton
Set customBar = CommandBars.Add("Custom")
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Cut").Id)
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Copy").Id)
Set newButton = customBar.Controls _
.Add(msoControlButton, CommandBars("Edit") _
.Controls("Paste").Id)
customBar.Visible = True
As it applies to the DocumentProperties object.
This example, which is designed to run in Microsoft Word, adds three custom document properties to the DocumentProperties collection.
With ActiveDocument.CustomDocumentProperties
.Add Name:="CustomNumber", _
LinkToContent:=False, _
Type:=msoPropertyTypeNumber, _
Value:=1000
.Add Name:="CustomString", _
LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:="This is a custom property."
.Add Name:="CustomDate", _
LinkToContent:=False, _
Type:=msoPropertyTypeDate, _
Value:=Date
End With
As it applies to the Permission object.
Dim objUserPerm As Office.UserPermission
Set objUserPerm = ActiveWorkbook.Permission.Add( _
"[email protected]", _
msoPermissionRead + msoPermissionEdit, #12/31/2005#)
MsgBox "Permissions added for " & _
objUserPerm.UserId, _
vbInformation + vbOKOnly, _
"Permissions Added"
Set objUserPerm = Nothing
As it applies to the PropertyTests object.
This example adds two property tests to the search criteria. The first test is that the files must be Microsoft Word documents, and the second test is that they must have been modified between January 1, 1996, and June 30, 1996. The example also displays a message box that shows the total number of files found, if any, and the name of each file found.
Set fs = Application.FileSearch
fs.NewSearch
With fs.PropertyTests
.Add Name:="Files of Type", _
Condition:=msoConditionFileTypeWordDocuments, _
Connector:=msoConnectorOr
.Add Name:="Last Modified", _
Condition:=msoConditionAnytimeBetween, _
Value:="1/1/98", SecondValue:="6/30/98", _
Connector:=msoConnectorAnd
End With
If fs.Execute() > 0 Then
For i = 1 To fs.FoundFiles.Count
strFound = strFound & fs.FoundFiles(i) & vbCrLf
Next i
MsgBox "Search found the following " _
& fs.FoundFiles.Count & _
" file(s):" & vbCrLf & strFound
Else
MsgBox "There were no files found."
End If
As it applies to the Scripts object.
This example adds a new Script to the specified range on worksheet one in the active workbook.
Dim rngScriptAnchorRange As Range
Dim objNewScript As Script
Set rngScriptAnchorRange = ActiveWorkbook. _
Worksheets(1).Range("B5")
Set objNewScript = ActiveWorkbook. _
Worksheets(1).Scripts.Add(rngScriptAnchorRange, _
msoScriptLocationInBody, _
msoScriptLanguageVisualBasic, _
"MyNewScript", , _
"MsgBox (""Added Script object MyNewScript"")")
As it applies to the SharedWorkspaceFiles object.
Dim swsfile As Office.SharedWorkspaceFile
Set swsfile = ActiveWorkbook.SharedWorkspace.Files.Add( _
"C:\MyWorkbook.xls", _
, True, True)
MsgBox "New file URL: " & swsfile.URL, _
vbInformation + vbOKOnly, _
"New File in Shared Workspace Files"
Set swsfile = Nothing
As it applies to the SharedWorkspaceFolders object.
Dim swsFolder As Office.SharedWorkspaceFolder
Set swsFolder = ActiveWorkbook.SharedWorkspace.Folders.Add("MyNewFolder")
MsgBox "New folder: " & swsFolder.FolderName, _
vbInformation + vbOKOnly, _
"New Folder in Shared Workspace"
Set swsFolder = Nothing
As it applies to the SharedWorkspaceLinks object.
Dim swsLink As Office.SharedWorkspaceLink
Set swsLink = ActiveWorkbook.SharedWorkspace.Links.Add( _
"http://msdn.microsoft.com", _
"Microsoft Developer Network Home Page", _
"My favorite developer site!")
MsgBox "New link: " & swsLink.Description, _
vbInformation + vbOKOnly, _
"New Link in Shared Workspace"
Set swsLink = Nothing
As it applies to the SharedWorkspaceMembers object.
Dim swsMember As Office.SharedWorkspaceMember
Set swsMember = ActiveWorkbook.SharedWorkspace.Members.Add( _
"[email protected]", _
"domain\user", _
"New User", _
"Contributor")
MsgBox "New member: " & swsMember.Name, _
vbInformation + vbOKOnly, _
"New Member in Shared Workspace)"
Set swsMember = Nothing
As it applies to the SharedWorkspaceTasks object.
Dim swsTask As Office.SharedWorkspaceTask
Dim swsMember As Office.SharedWorkspaceMember
Set swsMember = ActiveWorkbook.SharedWorkspace.Members(1)
Set swsTask = ActiveWorkbook.SharedWorkspace.Tasks.Add( _
"Complete document by year-end", _
msoSharedWorkspaceTaskStatusNotStarted, _
msoSharedWorkspaceTaskPriorityNormal, _
swsMember, _
"My first shared workspace task", #12/31/2005#)
MsgBox "New task: " & swsTask.Title, _
vbInformation + vbOKOnly, _
"New Task in Shared Workspace"
Set swsMember = Nothing
Set swsTask = Nothing