Partager via


Workbook.CheckInWithVersion Method (Excel)

Saves a workbook to a server from a local computer, and sets the local workbook to read-only so that it cannot be edited locally.

Version Information

Version Added: Excel 2007

Syntax

expression .CheckInWithVersion(SaveChanges, Comments, MakePublic, VersionType)

expression A variable that returns a Workbook object.

Parameters

Name

Required/Optional

Data Type

Description

SaveChanges

Optional

Variant

True to save the workbook to the server location. The default is True.

Comments

Optional

Variant

Comments for the revision of the workbook being checked in (applies only if SaveChanges is set to True).

MakePublic

Optional

Variant

True to allow the user to publish the workbook after it is checked in.

VersionType

Optional

Variant

Specifies versioning information for the workbook.

Return Value

Nothing

Remarks

Setting the MakePublic parameter to True 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 is set to True).

To take advantage of the collaboration features built into Microsoft Excel, documents must be stored on a Microsoft SharePoint Server.

Example

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

This example is for a workbook-level customization.

Private Sub WorkbookCheckIn() 
 If ActiveWorkbook.CanCheckIn Then 
 ActiveWorkbook.CheckInWithVersion _ 
 True, _ 
 "My updates.", _ 
 True, _ 
 XlCheckInVersionType.xlCheckInMinorVersion 
 Else 
 MessageBox.Show ("This workbook cannot be checked in") 
 End If 
End Sub

See Also

Concepts

Workbook Object

Workbook Object Members