Made the change, but I get the following error on the .copy method.
"Public member 'Selection' on type 'Worksheet' not found."
Main Topics
Browse All TopicsI've created an Excel Add-In with a custom ribbon tab in VS 2008 VB. I'm trying to open a new workbook and copy a sheet from the new workbook to the currently open workbook.
I've tried several different methods and combinations, but nothing works. I've found post of similar issues, but again no help. I can open the new workbook, but copying the worksheet over is what is causing my troubles.
In the code example I've included two methods I've attempted. One using the worksheet.copy method, and one using the range.copy method. Method 1 returns a "COM object that has been separated from its underlying RCW cannot be used" error. Method 2 seems to do nothing.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks. That worked. I don't know why this was so difficult. I always start by recording macros in Excel, but this was my first VSTO Excel add-in. Guess things are a little different. Attached is the final code.
For some reason some of the row heights change after doing the paste. If I do it manually the heights are correct.
Business Accounts
Answer for Membership
by: mas_oz2003Posted on 2009-10-07 at 19:44:52ID: 25522046
Method 1 only copies within the target workbook. thus it does not work.
9").UsedRa nge.Select () 9").Select ion.Copy()
The code snippet is the VBA code that does what you need, please modify method accordingly.
eg. I will change line 19 for
ActiveWorkbook.Sheets("200
ActiveWorkbook.Sheets("200
Select allOpen in new window