Hi Friends!!
I have this code which copy's the data from "Name.xlsx" to "Master.xslx"
I run this macro from Master.xslx file...
Sub mast()
If Dir("C:\test\Name.xlsx") <> "" Then
Workbooks.Open "C:\test\Name.xlsx"
Worksheets("Emp").Select
ActiveSheet.Cells.Select
Selection.Copy
Windows("Master").Activate
Worksheets("Sheet1").Select
Range("A1").Select
Selection.PasteSpecial
Else
MsgBox "File doesn't exist."
End If
End Sub
I need to alter this code so that, in case if the file "Name.xlsx" is already open, it should automatically save and close...
But right now, the error is dsipalying as
----Name.xlsx is already open. Reopening will cause any changes you made to be discarded . Do you want to reopen Name.xlsx------
Basically i am trying to get rid off this error by automatically saving the opened file before it gets closed.
Thanks Pals!!!
I have this code which copy's the data from "Name.xlsx" to "Master.xslx"
I run this macro from Master.xslx file...
Sub mast()
If Dir("C:\test\Name.xlsx") <> "" Then
Workbooks.Open "C:\test\Name.xlsx"
Worksheets("Emp").Select
ActiveSheet.Cells.Select
Selection.Copy
Windows("Master").Activate
Worksheets("Sheet1").Select
Range("A1").Select
Selection.PasteSpecial
Else
MsgBox "File doesn't exist."
End If
End Sub
I need to alter this code so that, in case if the file "Name.xlsx" is already open, it should automatically save and close...
But right now, the error is dsipalying as
----Name.xlsx is already open. Reopening will cause any changes you made to be discarded . Do you want to reopen Name.xlsx------
Basically i am trying to get rid off this error by automatically saving the opened file before it gets closed.
Thanks Pals!!!