Document.CheckIn method (Word)

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

Syntax

expression.CheckIn (SaveChanges, Comments, MakePublic)

expression Required. A variable that represents a Document object.

Parameters

Name Required/Optional Data type Description
SaveChanges Optional Boolean True saves the document to the server location. The default is True.
Comments Optional Variant Comments for the revision of the document being checked in (only applies if SaveChanges equals True).
MakePublic Optional Boolean True allows the user to perform a publish on the document after being checked in. This 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 (only applies if SaveChanges equals True). The default is False.

Remarks

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

Example

This example checks the server to see if the specified document can be checked in. If it can be, it saves and closes the document and checks it back into the server.

Sub CheckInOut(docCheckIn As String) 
 If Documents(docCheckIn).CanCheckin = True Then 
 Documents(docCheckIn).CheckIn 
 MsgBox docCheckIn & " has been checked in." 
 Else 
 MsgBox "This file cannot be checked in " & 
 "at this time. Please try again later." 
 End If 
End Sub

To call the CheckInOut subroutine, use the following subroutine and replace "https://servername/workspace/report.doc" with the file name of an actual file located on the server mentioned in the Remarks section earlier.

Sub CheckDocInOut() 
 Call CheckInOut (docCheckIn:="https://servername/workspace/report.doc") 
End Sub

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.