Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7418861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:57:43+00:00 2026-05-29T07:57:43+00:00

Well I am attempting to make my way through developing an Excel Add-in. I

  • 0

Well I am attempting to make my way through developing an Excel Add-in. I am trying small functions with the sample code in Excel 2007 SDK as as a guide. I am having difficulty with attempting to display a double type data in Excel. Assuming the UDF is called DisplayDouble() when the sample code is executed and a call is placed with an argument of real type data such as DisplayDouble(12.3) the sample code works yet if I attempt to use an argument that references a real type data from cell such as DisplayDouble(A1) where cell A1 in the Excel worksheet has the value 12.3 the sample code does not work

You can see the sample code below this paragraph. Any hints will help me move along the learning ladder

_declspec(dllexport) LPXLOPER12 WINAPI DisplayDouble (LPXLOPER12 n)
{
  static XLOPER12 xResult;
  XLOPER12 xlt;
  int error = -1;
  double d;

  switch (n->xltype)
  {

  case xltypeNum:
        d = (double)n->val.num;
        if (max < 0)
              error = xlerrValue;
        xResult.xltype = xltypeNum;
        xResult.val.num = d;
        break;

  case xltypeSRef:
        error = Excel12f(xlCoerce, &xlt, 2, n, TempNum12(xltypeNum));

        if (!error)
        {
              error = -1;
              d = xlt.val.w;
              xResult.xltype = xltypeNum;
              xResult.val.num = d;
        }
        Excel12f(xlFree, 0, 1, &xlt);
        break;
  default:
        error = xlerrValue;
        break;
  }

  if ( error != - 1 )
  {
        xResult.xltype = xltypeErr;
        xResult.val.err = error;
  }

  //Word of caution - returning static XLOPERs/XLOPER12s is not thread safe
  //for UDFs declared as thread safe, use alternate memory allocation mechanisms
  return(LPXLOPER12) &xResult;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:57:44+00:00Added an answer on May 29, 2026 at 7:57 am

    looks like you coerced the value to xltypeNum but are then taking the integer value, with d = xlt.val.w rather than d = xlt.val.num

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, it seems simple enough, but I can't find a way to add a
I am attempting to make a registration-like page for a small forum. To register
I am trying attempting to refactor the following code: public static void SaveSplitbar(RadSplitBar splitBar)
I'm attempting to make a site beautiful, and so far it's gone quite well,
well i have this messages table with sample values like these: msg_id recipient_id read
I'm building my first enterprise grade solution (at least I'm attempting to make it
I am attempting to make a horizontal scrolling portfolio site. I want to users
I am very new to Java as well as Android programming. I was attempting
Using php coding, I'm attempting to make a script which will grab content from
I'm attempting to reopen the String class in rails and add a bunch more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.