You have my sympathy, but unfortunately the only way to track this sort of error is to add logging and debugging code to your application. I worked in technical support for many years and often saw problems such as you describe, and yes, they were extremely difficult to diagnose.
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.
I made a .NET COM DLL (VS2012, C#) it registers fine with regasm, but not with regsvr32. Also when I add the .tlb into installer and extract the com stuff (Installshield 2012) there is no registry entries after I have ran the installer. DLL is 32-bit and I'm using 64-bit Windows.
I am using office 2007 interop DLL to create an Excel sheet in c#.NET.
when I tried to test my app on a machine with office 2003 installed I get an exception because of the version number of the DLL . How can I determine in runtime what version of office is installed and then load the appropriate interop DLL for that version ?
If you do not need features which became available in Office 2007, just use an interop dll for old versions of Office also when current Office is installed! A PIA created with Office XP still works with Office 2010.
Otherwise, you have to find out the registry keys of Excel...
Sorry, my English sucks, I hope I can express clearly.i want to add a bar to the windows explorer,after a long time searching,i'v made a bar using BandObjectsLib(a C# library) and added it in to the Explorer window.but i have to open it through "Menu-View-Explorer bar",and the bar also came out in IE :<.my question is how to make it opened automaticly when Windows Explorer is opend.Or any other way to do this,i want to add a big horizontal bar actually a region in the bottom (or somewhere else) of Windows Explorer,so i can put my code and usercontrols into it.i use C#,vs2012,windows 7.thank you!
I've just been handed the task of replacing an existing COM component.
It has to stay as a COM component as we have no ability to change the caller.
It has to able to call a COM component, that again we can't alter. i.e. where changing the middle part of an existing process and have to do so transparently.
I've been doing some background research, and it looks like I can create a .NET COM component easy enough. I've got a few q's though.
When you create the COM interface and class they have GUID's, do these GUID's have to match the existing COM component? Or is it when the caller makes the COM call the OS determines the component based on name?
Another requirement is that the final COM call is 'dynamic' in that the method name we have to call might change, assuming the method will act on the same data is this doable?
Last Visit: 31-Dec-99 18:00 Last Update: 26-Sep-16 13:21