How to Copy & Paste selected Range in Excel (MFC)

D

Daniel Xu

Hi, all,

I have not found any solution about how to use Copy & Paste function of
_Worksheet in Excel program sample. Dose anyone could help me, I would be a
happy guy. Thanks!
 
E

EdgeOfCity

HI,you can try this:
Range("a1").Copy Destination:=Range("b1")
Application.CutCopyMode = False

or range("a1").copy
range("b1").paste
 
S

Steve Garman

Daniel said:
Hi, all,

I have not found any solution about how to use Copy & Paste function of
_Worksheet in Excel program sample. Dose anyone could help me, I would be a
happy guy. Thanks!
You can make your own samples by using "Tools | Macros | Record Macro"

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 21/11/2003 by Steve Garman
'

'
Range("C2:D4").Select
Selection.Copy
Range("E10").Select
ActiveSheet.Paste
End Sub
 
D

Daniel Xu

HI, I mean use VC6.0 (MFC), not VB, how to translate?

Range("C2:D4").Select
Selection.Copy
Range("E10").Select
ActiveSheet.Paste

I can see these code in Excel Macro. but I never found any
help document or API explain in the website. Do you have
any information? Thanks!
 
D

Daniel Xu

And how to use Range::pasteSpecial(...), MSDN dose not
have any information about this, where can I find some doc?
 
D

Daniel Xu

I know how to do about it, it's simple, :)

COleVariant varRange2;
varRange2.vt = VT_DISPATCH;
V_DISPATCH(&varRange2) = (LPDISPATCH)range2;
V_DISPATCH(&varRange2)->AddRef();
range1.Copy(varRange2);

Thanks at all!
 
D

Daniel Xu

I know how to do about it, it's simple, :)

COleVariant varRange2;
varRange2.vt = VT_DISPATCH;
V_DISPATCH(&varRange2) = (LPDISPATCH)range2;
V_DISPATCH(&varRange2)->AddRef();
range1.Copy(varRange2);

Thanks at all!
 

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