Excel file

  • Thread starter Thread starter skchow
  • Start date Start date
S

skchow

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
 
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.)
 
Back
Top