Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to close a workbook which contains the macro that's just been run?


Hi Ryan,

Thank you kindly for your reply.

That extra bit of code (in red) was added after creating my initia
macro, which was running without error until the extra code was added.

Hence, I believe it is that extra bit of code (in red for closing th
workbook) that is the cause of the error message.

In any case, he way I've done it seems to be a bit cumbersome:

1. I select the workbook which contains the macro and make it th
active workbook
Workbooks("Replace_All Names.xls").Activate


2. Then close the active workbook (ie. the workbook which contains th
macro that I've made the active workbook by step 1.)
ActiveWorkbook.Close


Are there any other elegant ways of doing this simple task



--
dead_gir
-----------------------------------------------------------------------
dead_girl's Profile: http://www.excelforum.com/member.php...fo&userid=1559
View this thread: http://www.excelforum.com/showthread.php?threadid=27145

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
Macro to Close a specific workbook. Dmad11 Excel Discussion (Misc queries) 1 July 7th 09 09:28 PM
Macro to close workbook with prompt JMac[_2_] Excel Worksheet Functions 1 January 31st 08 05:29 PM
run macro on workbook close Nigel Excel Discussion (Misc queries) 3 November 29th 05 08:48 PM
How to close a workbook which contains the macro that's just been run? dead_girl Excel Programming 1 October 22nd 04 07:43 AM
Close Workbook from Macro Lou Excel Programming 2 May 18th 04 02:26 AM


All times are GMT +1. The time now is 09:46 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"