Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copy excel sheet
#1
I am trying to copy an excel sheet from one workbook to another with the following code. The problem is that it doesn't do anything. Do you have any suggestions here? Thanks a ton!
Code:
Copy      Help
ExcelSheet es1 es2

es1.Init("Yields" 4 "$desktop$\SFR.xlsm")
es2.Init("Summary" 4 "$desktop$\BTAv13.xlsm")
Excel.Application xlApp=es2.ws.Application
Excel.Workbook wb2=xlApp.ActiveWorkbook

es1.ws.Activate
es1.ws.Copy(@ wb2.sheets.Item(wb2.Sheets.Count))
wb2.ActiveSheet.Name="Test"
#2
I tested this code, works.
#3
Silly me. I was not saving the spreadsheet at the end. That is why when I opened the destination spreadsheet, it did not have the sheet. Thank you Gintaras!


Forum Jump:


Users browsing this thread: 1 Guest(s)