PC Review


Reply
Thread Tools Rate Thread

closing a workbook with a macro

 
 
Fan924
Guest
Posts: n/a
 
      29th Nov 2008

From a Macro, I have

Set wb1 = ActiveWorkbook
On Error Resume Next
Set wb2 = Workbooks("library.xls")
If wb2 Is Nothing Then
Set wb2 = Workbooks.Open("c:\My Documents\_MapForm\library.xls")
End If

before exiting the macro, is there a way I can close the workbook
"library.xls"???
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      29th Nov 2008
wb2.close savechanges:=false 'or true



Fan924 wrote:
>
> From a Macro, I have
>
> Set wb1 = ActiveWorkbook
> On Error Resume Next
> Set wb2 = Workbooks("library.xls")
> If wb2 Is Nothing Then
> Set wb2 = Workbooks.Open("c:\My Documents\_MapForm\library.xls")
> End If
>
> before exiting the macro, is there a way I can close the workbook
> "library.xls"???


--

Dave Peterson
 
Reply With Quote
 
Fan924
Guest
Posts: n/a
 
      29th Nov 2008
> wb2.close savechanges:=false 'or true

Thanks again Dave
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set macro to run automatically when closing workbook? =?Utf-8?B?V3VkZHVz?= Microsoft Excel Misc 9 8th Nov 2008 08:33 AM
Closing a workbook from a macro doesn't close the workbook =?Utf-8?B?RGF2ZSBQ?= Microsoft Excel Programming 2 10th Jul 2007 06:16 PM
Problem with closing workbook in macro =?Utf-8?B?c2xt?= Microsoft Excel Programming 1 11th Jun 2005 01:23 AM
Problem closing a workbook using a macro Steve Microsoft Excel Programming 3 21st Sep 2004 01:03 PM
Re: Macro to run when closing off workbook ... Bob Phillips Microsoft Excel Misc 1 15th Jul 2003 10:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:50 AM.