Sub Main() '~~> Opens Source Workbook. Change path and filename as applicable xlWorkBook = xlApp.Workbooks.Open("C:\Users\Thaneskumar\Desktop\Copy of SBL_Release_Yield Loss Update_HL_20150813072418.xlsx") MyDate = Format(Now, "dd") MyMonth = Format(Now, "MM") MyYear = Format(Now, "yyyy") Mydirectory = "C:\Users\Thaneskumar\Desktop\test" MyExtension = ".xlsx" MyFileName = Mydirectory + MyDate + MyMonth + "_" + MyYear + MyExtension ExcelApp = CreateObject("Excel.Application") xlWorkBook2 = ExcelApp.Workbooks.Add ExcelSheet = xlWorkBook2.Worksheets(1) '~~> Display Excel xlApp.Visible = True '~~> Set the source worksheet xlWorkSheet = xlWorkBook.Sheets("SBL Trend(daily)") '~~> Set the destination worksheet xlWsheet2 = xlWorkBook2.Sheets("Sheet1") '~~> Set the source range xlSourceRange = xlWorkSheet.Range("A18:Q22") ''~~> Set the destination range xlDestRange = xlWsheet2.Range("A3") '~~> Copy and paste the range xlSourceRange.Copy() xlDestRange.Select() xlDestRange.Paste() generategraph() xlWorkBook2.SaveAs(MyFileName) xlWorkBook2.Close() xlWorkBook.Close() End
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)