Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default How to close a excel file using Macro coding?

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

  #2   Report Post  
Posted to microsoft.public.excel.misc
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code the Macro to save and close a file? Eric Excel Discussion (Misc queries) 7 June 10th 07 03:28 PM
Macro to Open, then Close another File HROBERTSON Excel Discussion (Misc queries) 1 January 8th 07 06:41 PM
recrding macro,copy data thn close file, get messge abut clpbord PaddyBoy Excel Discussion (Misc queries) 2 October 25th 06 04:38 AM
Macro to close excel okanem Excel Discussion (Misc queries) 1 July 19th 05 10:01 AM
macro to close excel Pam C Excel Discussion (Misc queries) 1 May 5th 05 04:43 PM


All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"