![]() |
Excel file
Dear Sir,
I've created macro in Excel file named "macro.xls". This macro is open Excel file name "pc.xls" from my P.C path "C:\excel\". Once I run the macro, the Excel file "pc.xls" workbook is open but I want to close the Excel file("macro.xls") and the Excel file "pc.xls" is remain open for editing. The coding as below: Private Sub Workbook_Open() filepathw = "c:\excel\" fileorg = filepathw & "pc.xls" Workbooks.Open (fileorg) End Sub --- Message posted from http://www.ExcelForum.com/ |
Excel file
Add
thisworkbook.close savechanges:=false right before the "End Sub" It'll close the workbook that containst the procedure. (And it'll close it without saving. Make sure you save it before you run it.) skchow wrote: Dear Sir, I've created macro in Excel file named "macro.xls". This macro is open Excel file name "pc.xls" from my P.C path "C:\excel\". Once I run the macro, the Excel file "pc.xls" workbook is open but I want to close the Excel file("macro.xls") and the Excel file "pc.xls" is remain open for editing. The coding as below: Private Sub Workbook_Open() filepathw = "c:\excel\" fileorg = filepathw & "pc.xls" Workbooks.Open (fileorg) End Sub --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
All times are GMT +1. The time now is 08:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com