I'm not quite sure if the Worksheet.Paste method does what you want. It will copy text from the clipboard to the specified (or current) selection (see Worksheet.Paste Method[^]). Setting the second parameter to TRUE will not copy the text but place a link. So if you have copied the text from the file to the clipboard, you may use this function but should pass FALSE as second parameter (or COleVariant((long)DISP_E_PARAMNOTFOUND, VT_ERROR) as optional value which uses the default).
However, the first (also optional parameter) is a range object. Just declare the object, assign the return value of GetRange() and pass it to Paste():
Range objRange = objSheet.GetRange(COleVariant(TEXT("A1")),COleVariant(TEXT("M34")));
I am at home now but from what I remember when I tried to build the code with VISUAL C++ 6.0 I got a build error saying cannot convert paramter 1 from const struct &VARIANT to class Range The documentation says it accepts a range object as the first parm
but the prototype for the code is Paste(const &VARIANT,
WorkSheet.GetRange() returns a LPDISPATCH which can be assigned to a Range object. You can use the LPDISPATCH returned by GetRange() or access the underlying IDispatch pointer of an existing Range object using the LPDISPATCH() operator to create the required variant:
vtRng.vt = VT_DISPATCH;
// Assign LPDISPATCH returned by GetRange()
vtRng.pdispVal = objSheet.GetRange(COleVariant(TEXT("A1")),COleVariant(TEXT("M34")));
// Alternatively, access the IDispatch pointer of an existing Range object
// vtRng.pdispVal = objRange;
I keep pointing you to MSDN and various related pieces of documentation, but you keep coming back here asking for the same thing. Try using the tools at your disposal (Google, Bing etc) to find what you are looking for.
One of these days I'm going to think of a really clever signature.
I have asked a lot about how to read PDF files(just like JAWS, a quit good screen reader), what I want to ask is that does anybody know how JAWS make it. I mean,what kind of tech does JAWS take advantage of. I guess it used MSAA.
I'm trying to do the same thing with JAWS now, so I need your help, if anybody has done such things, please help! Appriciate it.