Document.CheckInWithVersion method (Word)

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

Syntax

expression. CheckInWithVersion( _SaveChanges_ , _Comments_ , _MakePublic_ , _VersionType_ )

expression A variable that represents a Document object.

Parameters

Name Required/Optional Data type Description
SaveChanges Optional Boolean True to save the document to the server location. The default is True.
Comments Optional Variant Comments for the revision of the document being checked in (applies only if SaveChanges is set to True).
MakePublic Optional Boolean True to allow the user to publish the document after it is checked in.
VersionType Optional Variant Specifies versioning information for the document.

Remarks

Setting the MakePublic parameter to True submits the document for the approval process, which can eventually result in a version of the document being published to users with read-only rights to the document (applies only if SaveChanges is set to True).

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

Example

The following example uses the CanCheckin method to determine whether the document has been stored on a Microsoft SharePoint 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 DocumentCheckIn() 
 If ActiveDocument.CanCheckin Then 
 ActiveDocument.CheckInWithVersion _ 
 True, _ 
 "My updates.", _ 
 True, _ 
 WdCheckInVersionType.wdCheckInMinorVersion 
 Else 
 MessageBox.Show ("This document cannot be checked in") 
 End If 
End Sub

See also

Document Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.