Share via


_Workbook.Close Method

Closes the object.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Sub Close ( _
    SaveChanges As Object, _
    Filename As Object, _
    RouteWorkbook As Object _
)
'Usage
Dim instance As _Workbook
Dim SaveChanges As Object
Dim Filename As Object
Dim RouteWorkbook As Object

instance.Close(SaveChanges, Filename, _
    RouteWorkbook)
void Close(
    Object SaveChanges,
    Object Filename,
    Object RouteWorkbook
)

Parameters

  • SaveChanges
    Type: System.Object

    Optional Object. If there are no changes to the workbook, this argument is ignored. If there are changes to the workbook and the workbook appears in other open windows, this argument is ignored. If there are changes to the workbook but the workbook doesn't appear in any other open windows, this argument specifies whether changes should be saved, as shown in the following table.

    Value

    Action

    True

    Saves the changes to the workbook. If there is not yet a file name associated with the workbook, then FileName is used. If FileName is omitted, the user is asked to supply a file name.

    False

    Does not save the changes to this file.

    Omitted

    Displays a dialog box asking the user whether or not to save changes.

  • Filename
    Type: System.Object

    Optional Object. Save changes under this file name.

  • RouteWorkbook
    Type: System.Object

    Optional Object. If the workbook doesn't need to be routed to the next recipient (if it has no routing slip or has already been routed), this argument is ignored. Otherwise, Microsoft Excel routes the workbook as shown in the following table.

    Value

    Meaning

    True

    Sends the workbook to the next recipient.

    False

    Doesn't send the workbook.

    Omitted

    Displays a dialog box asking the user whether the workbook should be sent.

Remarks

Closing a workbook using the Close method doesn't run any Auto_Close macros in the workbook. Use the RunAutoMacros method to run the Auto_Close macros.

See Also

Reference

_Workbook Interface

_Workbook Members

Microsoft.Office.Interop.Excel Namespace