View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default open and close files

Hi,

In Book A Alt+f11 to open VB editor and double click 'ThisWorkbook"

Paste the code below in on the right and change the path and name to the
workbook you want to open when Book A closes.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Workbooks.Open Filename:="C:\book1.xls"
End Sub

Mike
"Chi" wrote:

Hi,

Would you please help me to code? Thanks.
I have two files: A and B.
I open the file A to enter new information and then close it. As soon as I
close the file A, I would like the file B opens by itself. Please help

Thank you!
Chi