CheckIn Method

Microsoft Word Visual Basic

CheckIn Method

       

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.

expression.CheckIn(SaveChanges, MakePublic, Comments)

expression   Required. An expression that returns one of the objects in the Applies To list.

SaveChanges  Optional Boolean. True saves the document to the server location. The default is 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).

Comments  Optional Variant. Comments for the revision of the document being checked in (only applies if SaveChanges equals True).

Remarks

To take advantage of the collaboration features built into 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 the "http://servername/workspace/report.doc" file name with an actual file located on a server mentioned in the Remarks section above.

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