B
Brite Global (Aric)
Hi,
I have a selected range in a 2003 Workbook that contains a C# addin.
What I want is to Export that range into a new Workbook.
The SaveAs will not work (unless I am unaware of this), because I don't want
the Addin to be available in the new Workbook, just the data.
I tried the following:
Excel.Range cellRange, rng;
Excel.Worksheet src;
src = (Excel.Worksheet)Fleet.Globals.ThisWorkbook.ActiveSheet;
cellRange = src.get_Range(firstCell, lastCell);
Excel.Application xl = new Excel.Application();
Excel.Workbook wb =
(Excel.Workbook)xl.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
Excel.Worksheet ws = (Excel.Worksheet)wb.Sheets.get_Item(1);
rng = ws.get_Range(firstCell, lastCell);
cellRange.Select();
cellRange.Copy(rng);
ws.SaveAs(FileName, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, false);
Trying this I got an error: "Cannot empty the Clipboard"
Thanks,
Aric
I have a selected range in a 2003 Workbook that contains a C# addin.
What I want is to Export that range into a new Workbook.
The SaveAs will not work (unless I am unaware of this), because I don't want
the Addin to be available in the new Workbook, just the data.
I tried the following:
Excel.Range cellRange, rng;
Excel.Worksheet src;
src = (Excel.Worksheet)Fleet.Globals.ThisWorkbook.ActiveSheet;
cellRange = src.get_Range(firstCell, lastCell);
Excel.Application xl = new Excel.Application();
Excel.Workbook wb =
(Excel.Workbook)xl.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
Excel.Worksheet ws = (Excel.Worksheet)wb.Sheets.get_Item(1);
rng = ws.get_Range(firstCell, lastCell);
cellRange.Select();
cellRange.Copy(rng);
ws.SaveAs(FileName, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, false);
Trying this I got an error: "Cannot empty the Clipboard"
Thanks,
Aric