View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How to close a excel file using Macro coding?

You might try instead:-

Sub Eric()
ActiveWorkbook.Close savechanges = True 'Or if you want False
End Sub


Mike


"Eric" wrote:

Referring to the post in Worksheet Function

Once I open the file 1.xls, and try to run following Macro.
There is an error message "Array exceeds the range" [Translation from Chinese]

Sub Eric()
Workbooks("E:\1.xls").Close
End Sub

Does anyone have any suggestions what wrong is the above code? and how to
fix it?
Thanks in advance for any suggestions
Eric