<?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[Einen AnsiString an Excel übergeben]]></title><description><![CDATA[<p>Wie man daten aus einem dbgrid an excel übergibt weiß ich aber ich bekomme es nicht hin, den inhalt einer ansiString variablen in ein excel sheet zu nageln.</p>
<p>es gibt immer probs mit dem typ der variablen &quot;mandantenNummer_Ges &quot;</p>
<p>ich muss das bestimmt zu nem variant casten, aber wie???</p>
<pre><code>Variant strData;

            int j = 4;

                while (!Form1-&gt;grid_Anz-&gt;DataSource-&gt;DataSet-&gt;Eof)
                {
                    // Übertrage das Datum//////////////////////////////////
                    //Fields n = 0 = datum;1 = kennziffer, 2 = betrag
                    strData = Form1-&gt;grid_Anz-&gt;Fields[0]-&gt;AsVariant;

                    // j steht für die zeile und 1 für die spalte
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,1).
                    OlePropertySet(&quot;Value&quot;, strData);
                    /////////////////////////////////////////////////////////

                    // Übertrage die Kennzahl////////////////////////////////
                    strData = Form1-&gt;grid_Anz-&gt;Fields[1]-&gt;AsVariant;

                    // j steht für die zeile und 2 für die spalte
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,2).
                    OlePropertySet(&quot;Value&quot;, strData);

                    /////////////////////////////////////////////////////////

                    // Übertrage den Betrag//////////////////////////////////
                    strData = Form1-&gt;grid_Anz-&gt;Fields[2]-&gt;AsVariant;

                    // j steht für die zeile und 3 für die spalte
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,3).
                    OlePropertySet(&quot;Value&quot;, strData);
                    Form1-&gt;grid_Anz-&gt;DataSource-&gt;DataSet-&gt;Next();
                    j++;
                }
                     //wichtiger teil !!!!!!!!!!!!!!!!!!!!!!!!!//
                    //übertrage Mandantennummer aus Variablen                           
                    //:mandantenNummer_Ges ==&gt; ist ein AnsiString

                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, 1,4).
                    OlePropertySet(&quot;Value&quot;, mandantenNummer_Ges);
                    /////////////////////////////////////////////////////

                    // führe Makro aus
                    //MyEx.OleFunction(&quot;Run&quot;, &quot;Personalkostenanalyse&quot;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/166364/einen-ansistring-an-excel-übergeben</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 01:09:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/166364.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 28 Nov 2006 15:24:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Tue, 28 Nov 2006 15:24:41 GMT]]></title><description><![CDATA[<p>Wie man daten aus einem dbgrid an excel übergibt weiß ich aber ich bekomme es nicht hin, den inhalt einer ansiString variablen in ein excel sheet zu nageln.</p>
<p>es gibt immer probs mit dem typ der variablen &quot;mandantenNummer_Ges &quot;</p>
<p>ich muss das bestimmt zu nem variant casten, aber wie???</p>
<pre><code>Variant strData;

            int j = 4;

                while (!Form1-&gt;grid_Anz-&gt;DataSource-&gt;DataSet-&gt;Eof)
                {
                    // Übertrage das Datum//////////////////////////////////
                    //Fields n = 0 = datum;1 = kennziffer, 2 = betrag
                    strData = Form1-&gt;grid_Anz-&gt;Fields[0]-&gt;AsVariant;

                    // j steht für die zeile und 1 für die spalte
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,1).
                    OlePropertySet(&quot;Value&quot;, strData);
                    /////////////////////////////////////////////////////////

                    // Übertrage die Kennzahl////////////////////////////////
                    strData = Form1-&gt;grid_Anz-&gt;Fields[1]-&gt;AsVariant;

                    // j steht für die zeile und 2 für die spalte
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,2).
                    OlePropertySet(&quot;Value&quot;, strData);

                    /////////////////////////////////////////////////////////

                    // Übertrage den Betrag//////////////////////////////////
                    strData = Form1-&gt;grid_Anz-&gt;Fields[2]-&gt;AsVariant;

                    // j steht für die zeile und 3 für die spalte
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,3).
                    OlePropertySet(&quot;Value&quot;, strData);
                    Form1-&gt;grid_Anz-&gt;DataSource-&gt;DataSet-&gt;Next();
                    j++;
                }
                     //wichtiger teil !!!!!!!!!!!!!!!!!!!!!!!!!//
                    //übertrage Mandantennummer aus Variablen                           
                    //:mandantenNummer_Ges ==&gt; ist ein AnsiString

                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, 1,4).
                    OlePropertySet(&quot;Value&quot;, mandantenNummer_Ges);
                    /////////////////////////////////////////////////////

                    // führe Makro aus
                    //MyEx.OleFunction(&quot;Run&quot;, &quot;Personalkostenanalyse&quot;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1183149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1183149</guid><dc:creator><![CDATA[n00b_imp]]></dc:creator><pubDate>Tue, 28 Nov 2006 15:24:41 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Tue, 28 Nov 2006 15:45:46 GMT]]></title><description><![CDATA[<p>Hallo</p>
<blockquote>
<p>es gibt immer probs mit dem typ</p>
</blockquote>
<p>Ja und was für Probleme?!</p>
<p>Afk kannst du AnsiString an Variant übergeben. In deinem Fall also</p>
<pre><code class="language-cpp">strData = mandantenNummer_Ges;
OlePropertySet(&quot;Value&quot;, strData);
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1183174</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1183174</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 28 Nov 2006 15:45:46 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Wed, 29 Nov 2006 06:19:13 GMT]]></title><description><![CDATA[<p>habe ich probiert!</p>
<pre><code>strData = mandantenNummer_Ges;
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, 1,4).
                    OlePropertySet(&quot;Value&quot;, strData);
</code></pre>
<p>Schmiert ab mit: &quot;Falscher Variable Typ!&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1183500</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1183500</guid><dc:creator><![CDATA[n00b_imp]]></dc:creator><pubDate>Wed, 29 Nov 2006 06:19:13 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Wed, 29 Nov 2006 08:45:40 GMT]]></title><description><![CDATA[<p>Probier mal eine der beiden folgenden Varianten</p>
<pre><code class="language-cpp">MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, 1,4).
OlePropertySet(&quot;Value&quot;, strData.c_str());
</code></pre>
<p>oder</p>
<pre><code class="language-cpp">MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, 1,4).
OlePropertySet(&quot;Value&quot;, Variant(strData));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1183593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1183593</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 29 Nov 2006 08:45:40 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Wed, 29 Nov 2006 09:16:51 GMT]]></title><description><![CDATA[<p>zu1: strData.str() geht nicht bei Variant<br />
zu2: &quot;falscher Variable Typ!&quot;<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1183618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1183618</guid><dc:creator><![CDATA[n00b_imp]]></dc:creator><pubDate>Wed, 29 Nov 2006 09:16:51 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Wed, 29 Nov 2006 09:47:17 GMT]]></title><description><![CDATA[<p>Ich hatte fälschlicherweise angenommen, dass strData vom Typ AnsiString ist. Warum übergibst du nicht direkt mandantenNummer_Ges? Abgesehen davon sollte die Variante von akari problemlos funktionieren. Vielleicht liegt es ja gar nicht an strData.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1183647</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1183647</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 29 Nov 2006 09:47:17 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Wed, 29 Nov 2006 09:51:46 GMT]]></title><description><![CDATA[<p>weil das von akari auch nicht geht....ich vermute er hat das problem einen ansiString zu übergeben!</p>
<p>Mache ich das so:</p>
<pre><code>int castedManNGes;
                    castedManNGes = StrToInt(mandantenNummer_Ges);
                    strData = castedManNGes;
                    MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, 1,4).
                    OlePropertySet(&quot;FormulaR1C1&quot; , strData);
</code></pre>
<p>...funktioniert das!!!!<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1183651</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1183651</guid><dc:creator><![CDATA[n00b_imp]]></dc:creator><pubDate>Wed, 29 Nov 2006 09:51:46 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Thu, 30 Nov 2006 08:25:27 GMT]]></title><description><![CDATA[<p>so ein mist!<br />
ich kann zwar zahlen übergeben aber keine zeichenketten aus einer variablen.</p>
<pre><code>// j steht für die zeile und 1 für die spalte
 MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,2).
 OlePropertySet(&quot;Value&quot;, strData);
</code></pre>
<p>will ich in strData(Variant) zeichenketten speichern bekomme ich immer falscher variabletyp zahlenwerte funktionieren aber.</p>
<p>schreibe ich</p>
<pre><code>// j steht für die zeile und 1 für die spalte
                      MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,2).
                      OlePropertySet(&quot;Value&quot;, &quot;hasse nich gesehen&quot;);
</code></pre>
<p>geht das auch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
ratlos....plz help</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1184244</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1184244</guid><dc:creator><![CDATA[n00b_imp]]></dc:creator><pubDate>Thu, 30 Nov 2006 08:25:27 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Thu, 30 Nov 2006 08:33:52 GMT]]></title><description><![CDATA[<p>Wie gesagt, probiers mal so</p>
<pre><code class="language-cpp">MyWS.OlePropertyGet(&quot;Cells&quot;).OlePropertyGet(&quot;Item&quot;, j,2).OlePropertySet(&quot;Value&quot; , mandantenNummer_Ges.c_str());
</code></pre>
<p>Du könntest auch einfach die im Link erwähnte Wrapperklassen verwenden<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39259.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39259.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1184250</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1184250</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 30 Nov 2006 08:33:52 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Thu, 30 Nov 2006 08:45:36 GMT]]></title><description><![CDATA[<p>ja so gehts!!!! DANKE Braunstein!<br />
Was ist das für eine Funktion???<br />
Was macht die und warum ist das hier notwendig???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1184265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1184265</guid><dc:creator><![CDATA[n00b_imp]]></dc:creator><pubDate>Thu, 30 Nov 2006 08:45:36 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Thu, 30 Nov 2006 10:45:56 GMT]]></title><description><![CDATA[<p>Schau doch einfach mal in die Hilfe zu AnsiString.<br />
c_str() gibt einen const char* zurück (Nullterminiert), der den String enthält. Scheinbar erwartet OlePropertySet(&quot;Value&quot; , ..); einen derartigen String. Normalerweise steht hier ein Variant und der hat eigentlich einen Konstruktor für AnsiString. Schau doch auch mal in die Bibliothek von AndreasW (siehe obigen Link). Die verwende ich auch. Ich habe sie allerdings noch etwas verändert (debuggt und erweitert). Wenn du willst kann ich sie dir zuschicken oder falls ein Moderator das zulässt in die FAQ mit einfügen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1184363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1184363</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 30 Nov 2006 10:45:56 GMT</pubDate></item><item><title><![CDATA[Reply to Einen AnsiString an Excel übergeben on Thu, 30 Nov 2006 18:10:12 GMT]]></title><description><![CDATA[<p>Wenn sie ordentlich kommentiert ist, gerne. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Poste sie ggf. hier, wir werden den FAQ-Eintrag dann entsprechend erweitern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1184792</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1184792</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Thu, 30 Nov 2006 18:10:12 GMT</pubDate></item></channel></rss>