Share via


Workbook.Comments Property (2007 System)

Gets or sets the comments attached to the workbook.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property Comments As String
'Usage
Dim instance As Workbook 
Dim value As String 

value = instance.Comments

instance.Comments = value
[BrowsableAttribute(false)]
public string Comments { get; set; }
[BrowsableAttribute(false)]
public:
property String^ Comments {
    String^ get ();
    void set (String^ value);
}
public function get Comments () : String 
public function set Comments (value : String)

Property Value

Type: System.String
The comments attached to the workbook.

Remarks

This property corresponds to the Comments field in the workbook's Properties dialog.

Examples

The following code example sets values in the Comments, Title and Tag properties and then programmatically displays the Microsoft Office Excel Properties dialog to verify that these values were set.

This example is for a document-level customization.

Private Sub AddWorkbookMetadata()
    Me.Comments = "This workbook contains sales data from 2004." 
    Me.Title = "Sales Data" 
    Me.Tag = "Sales" 
    Me.Keywords = "Sales" 
    Me.Application.Dialogs( _
        Excel.XlBuiltInDialog.xlDialogProperties).Show()
End Sub
private void AddWorkbookMetadata()
{
    this.Comments = "This workbook contains sales data from 2004.";
    this.Title = "Sales Data";
    this.Tag = "Sales";
    this.Keywords = "Sales";

    this.Application.Dialogs[
        Excel.XlBuiltInDialog.xlDialogProperties].Show(
        missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing, missing);
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace