ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   closing a workbook with a macro (https://www.excelbanter.com/excel-programming/420645-closing-workbook-macro.html)

Fan924

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"???

Dave Peterson

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

Fan924

closing a workbook with a macro
 
wb2.close savechanges:=false 'or true

Thanks again Dave


All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com