View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to close a excel file using Macro coding?

Don't specify the drive and path.

Do NOT specify the drive and path.

Eric wrote:

I already specify the drive and path, but it still does not work.
Does anyone know how to solve this coding for closing a file?
Thank for any suggestions
Eric

"Dave Peterson" wrote:

Workbooks("1.xls").Close

You don't specify the drive and path when you use that workbooks(...)
collection.

Eric wrote:

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


--

Dave Peterson


--

Dave Peterson