COPY AN EXCEL WORKSHEET TO A NEW SHEET

I’ve tried everything I know to try and I cannot find the Excel Automation string to copy the active worksheet to a new sheet. I’ve already searched the visual basic help in Excel, and tried all the following: xlSheet[SheetNumber].Copy(NewSheetName); and tried xlSheet[SheetNumber].Copy; and xlWorksheets(SheetNumber).Copy after := Worksheets(NewSheetName); I’m now in serious distress. I just need a simple line of code that will allow me to copy the current worksheet to a new sheet - and it would be nice if I could have it placed after the current sheet, and name it. HELP![:(]

Is this an Axapta question? In Axapta it is done like this: excelDocument.insertSheet(1,1); // this inserts a new Sheet after the first one, copied from the first one. workSheet = excelDocument.getWorkSheet(2); workSheet.name(“Kashperuk”); // and this changes the name of the second worksheet

Ivan, Thanks for the help, but I’m afraid it’s Navision Attain (v 3.6). The code you offered wouldn’t work at all. Please, someone help!

ooops…just noticed this is the Axapta forum…forgive me…I’ll move the topic. Thanks again.[:I]

Sorry couldn’t help. By the way, you are on the Axapta Development forum. :slight_smile: That’s why the question appeared. :slight_smile: I doubt someone will answer it here.