Copy a TextBox (shape)

M

Mark

Hi -

I am working in C# VSTO and Excel 2007 but thought I'd ask how to do this in
VBA and maybe it would help with the C# code.

I just want to copy a shape (textbox) with all of its text and formating
(e.g., Bold, no fill, no line). And paste it multiple times down the page
(via a loop), actually to a different workbook.

I've tried shape.copy but don't know how to paste it where I want it.
I've tried shape.duplicate but can't get that to work either.

Much thanks for ideas.

Mark
 
O

OssieMac

Hi Mark,

I haven't been able to do this without actually activating the 2nd workbook
and worksheet and selecting the paste location. However, here is what I have
that works but maybe someone else can do it better.

Windows("Book1").Activate
Sheets("Sheet1").Shapes("TextBox1").Copy
Windows("Book4").Activate
Sheets("Sheet2").Activate
Range("B8").Select
ActiveSheet.Paste
 
M

Mark

Leith -

I'm not sure, its the type that you can create in Excel 2007 ...
Insert/Text/TextBox.

Mark
 
M

Mark

OssieMac -

Thank you, Mark

OssieMac said:
Hi Mark,

I haven't been able to do this without actually activating the 2nd workbook
and worksheet and selecting the paste location. However, here is what I have
that works but maybe someone else can do it better.

Windows("Book1").Activate
Sheets("Sheet1").Shapes("TextBox1").Copy
Windows("Book4").Activate
Sheets("Sheet2").Activate
Range("B8").Select
ActiveSheet.Paste
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top