LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Range Between Workbooks

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.Active Sheet;

cellRange = src.get_Range(firstCell, lastCell);

Excel.Application xl = new Excel.Application();
Excel.Workbook wb =
(Excel.Workbook)xl.Workbooks.Add(Excel.XlWBATempla te.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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a range from closed workbooks (ADO) nc Excel Discussion (Misc queries) 3 October 17th 05 06:02 PM
copy range to multiple workbooks davez Excel Discussion (Misc queries) 4 August 27th 05 01:14 AM
Copy a range in two different workbooks Bhavtosh Excel Programming 0 May 16th 05 11:18 AM
Copy/paste range variable between workbooks Jim73 Excel Programming 2 January 14th 05 08:17 AM
Copy range between workbooks Dave Newman[_2_] Excel Programming 2 August 1st 03 11:01 PM


All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"