- 코드 -
Dim XL1, XL2 As Application
Dim wb1, wb2 As Workbook
Dim s1, s2 As Worksheet
Set XL1 = CreateObject("Excel.Application")
XL1.Visible = False
Set wb1 = XL1.Workbooks.Open(txtOldFile.Text) 'material balance file;
Set XL2 = CreateObject("Excel.Application")
XL2.Visible = False
Set wb2 = XL2.Workbooks.Open(txtNewFile.Text) 'equipment list file'
'material balance sheet를 eqlist의 제일 마지막에 복사'
XL1.Worksheets("Material").UsedRange.Copy
Set NewSheet = XL2.Worksheets.Add(After:=XL2.Worksheets(XL2.Worksheets.Count))
NewSheet.Range("A2").PasteSpecial Paste:=xlValues
NewSheet.Name = "Material"
XL2.DisplayAlerts = False
wb2.SaveAs (txtNewFile.Text)
XL2.DisplayAlerts = True
XL1.DisplayAlerts = False
XL1.Quit
XL2.Quit
Set XL1 = Nothing
Set XL2 = Nothing
댓글
댓글 쓰기