Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Copy - Paste in Excel using Ole

767 views
Skip to first unread message

Hans Reidar Havik

unread,
Jul 20, 1999, 3:00:00 AM7/20/99
to

Hello

My powerbuilder application create an excel document. In this document it is
a big amount of repeatedly data. To save time when creating the excel
document, I'd like my powerbuilder application to perform a "copy - paste -
paste - paste ..." - operation in the excel sheet. I manage to copy an area,
but I cant manage to paste it anywhere.
I'll be happy for every kind of help.

Regards
Hans


Joe Casale

unread,
Jul 22, 1999, 3:00:00 AM7/22/99
to
The way I usually do this is to first select the area I want to paste into then
call the paste method. Since you know the size of the area you are copying the
following should work for you:

string cell1,cell2
cell1 = "A1:A5" // What I am copying
cell2 = "B1:B5" // Where I am pasting to
ole_1.Activate(InPlace!)
ole_1.Object.Application.ActiveSheet.Range(cell1).Value="10" // Enter data into
the cells
ole_1.Object.Application.ActiveSheet.Range(cell1).Copy() // Copy the data

ole_1.Object.Application.ActiveSheet.Range(cell2).Select // Select the
area I want to paste to
ole_1.Object.Application.ActiveSheet.paste() // Paste
the data


Hope this helps,
Joe Casale

0 new messages