English 中文(简体)
为什么Caller(Type.Missing)申请回来是一种负面的愤怒?
原标题:Why Application.get_Caller(Type.Missing) returns a negative integer?

在<代码>get_Caller(Type.Missing)方法上,有点 we。 它退回了一种负面的分类,即-2146826265,而不是Range的标语。

是否有任何人提到这一问题? 为什么如此,我如何解决这一问题?

感谢。

Excel.Range range = (Excel.Range) application.get_Caller(System.Type.Missing);

The above code would fail if I try to explicitly user type Excel.Range. The error message says, Cannot convert type int to Microsoft.Office.Interop.Excel.Range .

EDIT:

接听手机的用意是将其传给我的以下职能:

private string getResultFromResultSheet(Excel.Range originalSheetRange, Excel.Worksheet resultSheet)
        {
            string DataResult = "";
            try
            {
                string os_currentAddress = originalSheetRange.get_Address(Type.Missing, Type.Missing, Excel.XlReferenceStyle.xlA1, Type.Missing, Type.Missing);
                Excel.Range currentRRange = null;

                currentRRange = resultSheet.get_Range(os_currentAddress, Type.Missing);
                if (currentRRange != null)
                {
                    if (string.IsNullOrEmpty(Convert.ToString(currentRRange.Value)))
                        DataResult = "";
                    else
                        DataResult = Convert.ToString(currentRRange.Value);
                }
            }
            catch (Exception ex)
            {
            }
            return DataResult;
        }

With the return value from that function, I can pass it back to UDF and display it in the original cell. Is there any better way to implement the function?

问题回答

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application.quester.aspx” rel=“nofollow”MSDN Library article 。 传票财产。 你们已发现法国扫盲基金会的价值! 错误。 页: 1 鉴于打电话者是你的C#方案,我怀疑你可以使用这一财产。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签