<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[XLL Add-In für Excel mit C&#x2F;C++ programmiert]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte gerne ein XLL für Excel entwickeln. Hab das jetzt mit der Excel2007 XLL SDK gemacht und versucht das XLL dann als Add-In in Excel 2003 hinzuzufügen.<br />
Funktioniert leider nicht. Excel sagt, das wäre kein gültiges Add-In. Hat da jemand vielleicht Erfahrungen damit?<br />
Im Internet findet man irgendwie nur Beschreibungen wie das ganze mit Excel 97 geht. In der SDK ist das ganze dann für Excel 2007 beschrieben. Da ist die C-API dann schon wieder anders. Vielleicht ist aber auch mein Code falsch.<br />
Hier mal kurz der Code:</p>
<pre><code class="language-cpp">static LPSTR func[1][10] = {
  {&quot;add&quot;, &quot;JJJ&quot;, &quot;add&quot;, &quot;&quot;, &quot;1&quot;, &quot;MyCat&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;,&quot;&quot;}
  };

BOOL APIENTRY DllMain( HANDLE hDLL, 
					   DWORD dwReason, 
					   LPVOID lpReserved )
{
	switch (dwReason)
	{
	case DLL_PROCESS_ATTACH:

		// The instance handle passed into DllMain is saved
		// in the global variable g_hInst for later use.

		break;
	case DLL_PROCESS_DETACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	default:
		break;
	}
	return TRUE;
}

__declspec(dllexport) int add(int a, int b)
{
	return a+b;
}

__declspec(dllexport) int WINAPI xlAutoOpen(void) {

         // DEBUG output to indicate when called
         int i, j;
		 int nFuncs=1;

         // Get XLL file name
         static XLOPER xDll;
         Excel12f(xlGetName, &amp;xDll, 0);

         // Prefix strengths with their length &amp; count items
         // Note the framework's TempStr() function prefixes the
         // lengths anyway, but this is for other code that might
         // use the arrays
         /*for(nFuncs=0;     func[nFuncs][0];     nFuncs++) {
             for(i=0; i&lt;9; i++) {
                 func[nFuncs][i][0]     = (BYTE) strlen(func[nFuncs][i]+1);
             }

         }*/

         /*for(nMenuItems=0; menu[nMenuItems][0]; nMenuItems++) {
             for(i=0; i&lt;5; i++) {
             menu[nMenuItems][i][0] = (BYTE) strlen(menu[nMenuItems][i]+1);
             }
         }*/

         // Loop through the function list, and register the functions
         for(i=0; i&lt;nFuncs; i++) {

            // Register a function
            Excel12f(xlfRegister, 0, 11, (LPXLOPER12)&amp;xDll,
               (LPXLOPER12)TempStr(func[i][0]),
               (LPXLOPER12)TempStr(func[i][1]),
               (LPXLOPER12)TempStr(func[i][2]),
               (LPXLOPER12)TempStr(func[i][3]),
               (LPXLOPER12)TempStr(func[i][4]),
               (LPXLOPER12)TempStr(func[i][5]),
               (LPXLOPER12)TempStr(func[i][6]),
               (LPXLOPER12)TempStr(func[i][7]),
               (LPXLOPER12)TempStr(func[i][8]),
			   (LPXLOPER12)TempStr(func[i][9])
               );
         }

         // Free XLL file name from the xlGetName call made earlier
         Excel12f(xlFree, 0, 1, (LPXLOPER)&amp;xDll);

        // // Menu support section
        // static XLOPER xMenu;
        // static XLOPER xMenuList[10*5];
        // ASSERT(nMenuItems&lt; 10);

        // // Build menu
        // xMenu.xltype            = xltypeMulti;
        // xMenu.val.array.lparray = &amp;xMenuList[0];
        // xMenu.val.array.rows    = nMenuItems;
        // xMenu.val.array.columns = 5;

        // for(i=0; i&lt;nMenuItems; i++) {
        //     for(j=0; j&lt;5; j++) {
        //         xMenuList[j+i*5].xltype  = xltypeStr;
        //         xMenuList[j+i*5].val.str = menu[i][j];
        //     }
        // }

        // // Add menu
        //Excel(xlfAddMenu,0,3,TempNum(1),(LPXLOPER)&amp;xMenu,TempStr(&quot; Help&quot;));

         // Finished
         return 1;
      }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/211850/xll-add-in-für-excel-mit-c-c-programmiert</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 11:24:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/211850.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Apr 2008 14:23:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to XLL Add-In für Excel mit C&#x2F;C++ programmiert on Mon, 28 Apr 2008 14:23:11 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte gerne ein XLL für Excel entwickeln. Hab das jetzt mit der Excel2007 XLL SDK gemacht und versucht das XLL dann als Add-In in Excel 2003 hinzuzufügen.<br />
Funktioniert leider nicht. Excel sagt, das wäre kein gültiges Add-In. Hat da jemand vielleicht Erfahrungen damit?<br />
Im Internet findet man irgendwie nur Beschreibungen wie das ganze mit Excel 97 geht. In der SDK ist das ganze dann für Excel 2007 beschrieben. Da ist die C-API dann schon wieder anders. Vielleicht ist aber auch mein Code falsch.<br />
Hier mal kurz der Code:</p>
<pre><code class="language-cpp">static LPSTR func[1][10] = {
  {&quot;add&quot;, &quot;JJJ&quot;, &quot;add&quot;, &quot;&quot;, &quot;1&quot;, &quot;MyCat&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;,&quot;&quot;}
  };

BOOL APIENTRY DllMain( HANDLE hDLL, 
					   DWORD dwReason, 
					   LPVOID lpReserved )
{
	switch (dwReason)
	{
	case DLL_PROCESS_ATTACH:

		// The instance handle passed into DllMain is saved
		// in the global variable g_hInst for later use.

		break;
	case DLL_PROCESS_DETACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	default:
		break;
	}
	return TRUE;
}

__declspec(dllexport) int add(int a, int b)
{
	return a+b;
}

__declspec(dllexport) int WINAPI xlAutoOpen(void) {

         // DEBUG output to indicate when called
         int i, j;
		 int nFuncs=1;

         // Get XLL file name
         static XLOPER xDll;
         Excel12f(xlGetName, &amp;xDll, 0);

         // Prefix strengths with their length &amp; count items
         // Note the framework's TempStr() function prefixes the
         // lengths anyway, but this is for other code that might
         // use the arrays
         /*for(nFuncs=0;     func[nFuncs][0];     nFuncs++) {
             for(i=0; i&lt;9; i++) {
                 func[nFuncs][i][0]     = (BYTE) strlen(func[nFuncs][i]+1);
             }

         }*/

         /*for(nMenuItems=0; menu[nMenuItems][0]; nMenuItems++) {
             for(i=0; i&lt;5; i++) {
             menu[nMenuItems][i][0] = (BYTE) strlen(menu[nMenuItems][i]+1);
             }
         }*/

         // Loop through the function list, and register the functions
         for(i=0; i&lt;nFuncs; i++) {

            // Register a function
            Excel12f(xlfRegister, 0, 11, (LPXLOPER12)&amp;xDll,
               (LPXLOPER12)TempStr(func[i][0]),
               (LPXLOPER12)TempStr(func[i][1]),
               (LPXLOPER12)TempStr(func[i][2]),
               (LPXLOPER12)TempStr(func[i][3]),
               (LPXLOPER12)TempStr(func[i][4]),
               (LPXLOPER12)TempStr(func[i][5]),
               (LPXLOPER12)TempStr(func[i][6]),
               (LPXLOPER12)TempStr(func[i][7]),
               (LPXLOPER12)TempStr(func[i][8]),
			   (LPXLOPER12)TempStr(func[i][9])
               );
         }

         // Free XLL file name from the xlGetName call made earlier
         Excel12f(xlFree, 0, 1, (LPXLOPER)&amp;xDll);

        // // Menu support section
        // static XLOPER xMenu;
        // static XLOPER xMenuList[10*5];
        // ASSERT(nMenuItems&lt; 10);

        // // Build menu
        // xMenu.xltype            = xltypeMulti;
        // xMenu.val.array.lparray = &amp;xMenuList[0];
        // xMenu.val.array.rows    = nMenuItems;
        // xMenu.val.array.columns = 5;

        // for(i=0; i&lt;nMenuItems; i++) {
        //     for(j=0; j&lt;5; j++) {
        //         xMenuList[j+i*5].xltype  = xltypeStr;
        //         xMenuList[j+i*5].val.str = menu[i][j];
        //     }
        // }

        // // Add menu
        //Excel(xlfAddMenu,0,3,TempNum(1),(LPXLOPER)&amp;xMenu,TempStr(&quot; Help&quot;));

         // Finished
         return 1;
      }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1499704</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1499704</guid><dc:creator><![CDATA[TomTom85]]></dc:creator><pubDate>Mon, 28 Apr 2008 14:23:11 GMT</pubDate></item></channel></rss>