Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 238
Default closing a workbook with a macro


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"???
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default closing a workbook with a macro

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 238
Default closing a workbook with a macro

wb2.close savechanges:=false 'or true

Thanks again Dave
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
Set macro to run automatically when closing workbook? Wuddus Excel Discussion (Misc queries) 10 January 20th 15 03:39 PM
Closing Excel with Personal Macro Workbook [email protected] Excel Discussion (Misc queries) 6 November 7th 07 11:07 PM
Closing a workbook from a macro doesn't close the workbook Dave P Excel Programming 2 July 10th 07 06:16 PM
Problem with closing workbook in macro slm Excel Programming 1 June 11th 05 01:23 AM
Problem closing a workbook using a macro Steve Excel Programming 3 September 21st 04 01:03 PM


All times are GMT +1. The time now is 11:15 AM.

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

About Us

"It's about Microsoft Excel"