Share via


WorkbookBase.CheckInWithVersion Method

Sends the workbook from the local computer to a server, and sets the local workbook to read-only so that it cannot be edited locally. Calling this method closes the workbook.

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

Syntax

'Declaration
Public Sub CheckInWithVersion ( _
    saveChanges As Object, _
    comments As Object, _
    makePublic As Object, _
    versionType As Object _
)
public void CheckInWithVersion(
    Object saveChanges,
    Object comments,
    Object makePublic,
    Object versionType
)

Parameters

  • saveChanges
    Type: System.Object

    true to save changes and check in the document; false to return the document to a checked-in state without saving revisions.

  • comments
    Type: System.Object

    true to enable check-in comments; false to check in the workbook without comments. This parameter applies only if SaveChanges is true.

  • makePublic
    Type: System.Object

    true to enable the user to publish the workbook after it has been checked in. This submits the workbook for the approval process, which can eventually result in a version of the workbook being published to users with read-only rights to the workbook (applies only if SaveChanges equals true).

  • versionType
    Type: System.Object

    Specifies versioning information for the document.

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the CanCheckIn method to determine whether the document has been stored on a Microsoft Office SharePoint Portal Server. If the document has been stored on a server, the example calls the CheckInWithVersion method to check in the document along with the specified comments and version number, save changes to the server location, and submit the document for the approval process.

This example is for a document-level customization.

Private Sub CheckInWorkbook()
    If Me.CanCheckIn() Then 
        Dim comments As Object = "My updates." 
        Dim version As Object = Excel.XlCheckInVersionType.xlCheckInMinorVersion
        Me.CheckInWithVersion(True, comments, True, version)
    Else
        MessageBox.Show("This document cannot be checked in")
    End If 
End Sub
private void CheckInWorkbook()
{
    if (this.CanCheckIn())
    {
        object comments = "My updates.";
        object version = Excel.XlCheckInVersionType.xlCheckInMinorVersion;
        this.CheckInWithVersion(true, comments, true, version);
    }
    else
    {
        MessageBox.Show("This document cannot be checked in");
    }
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace