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, MakePublic, Comments, VersionType)
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. |
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). |
VersionType |
Optional |
Variant |
Specifies versioning information for the document. |
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 above.
Sub CheckDocInOut()
Call CheckInOut (docCheckIn:="https://servername/workspace/report.doc")
End Sub