CheckOut Method

Microsoft Word Visual Basic

CheckOut Method

       

Copies a specified document from a server to a local computer for editing.

expression.CheckOut(FileName)

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

FileName  Required String. The name of the file to check out.

Remarks

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

Example

This example verifies that a document is not checked out by another user and that it can be checked out. If the document can be checked out, it copies the document to the local computer for editing.

Sub CheckInOut(docCheckOut As String)
    If Documents.CanCheckOut(docCheckOut) = True Then
        Documents.CheckOut docCheckOut
    Else
        MsgBox "You are unable to check out this document at this time."
    End If
End Sub

To call the CheckInOut subroutine above, 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