When i am opening another workbook,I need to save and close the existed workbook?

ravikumar00008

New member
Joined
Jun 13, 2012
Messages
20
Reaction score
0
Points
0
Hi All,

How can i do like this.

I am opening second workbook from the first workbook at that time how can i save and close the first workbook.

So, that one workbook should open at a time.

This is how i tried but not succeeded.

Code:
Application.Workbooks.Open ("E:\Second_Data.xlsx")
Application.Workbooks("E:\First_Data.xlsx").Save
Application.Workbooks("E:\First_Data.xlsx").Close

Please help to solve this.

Regards
Kumar
 
Code:
If WorkbookIsOpen("First_Data.xlsx") Then
Workbooks("First_Data.xlsx").Close savechanges:=True
  End If
 
Hi Tommy,

Thanks for the reply.
I got the solution to it.

Code:
ThisWorkbook.Save
ThisWorkbook.Close

Regards
Kumar
 
Back
Top