|
Sub TEST()
Dim strFileName$, strPath$, wkb As Workbook, wks As Worksheet, strName$, shp As Shape
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set wks = Sheets(1)
strName = [L2]
strPath = ThisWorkbook.Path & "\"
strFileName = strPath & [L3] & ".xls"
Set wkb = Workbooks.Open(strFileName)
wks.Copy after:=Worksheets(Worksheets.Count)
If bIsWorksheetExist(strName) Then Worksheets(strName).Delete
Worksheets(Worksheets.Count).Name = strName
For Each shp In ActiveSheet.Shapes
shp.Delete
Next
wkb.Close True
Set wkb = Nothing
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Beep
End Sub
Public Function bIsWorksheetExist(wksName As String) As Boolean
On Error Resume Next
bIsWorksheetExist = Sheets(wksName).Name = wksName
End Function
|
|