<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Excel Automation WorkSheets.Add method in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847443#M64797</link>
    <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Hello:&lt;BR /&gt;&lt;BR /&gt;In the past, when using the Worksheets_Add function, I've passed the "worksheets" object as the first argument. Like you mentioned, there seems to be very little documentation about this, so I can't answer why "Workbooks" (somewhat) worked for you, but not "workbook". All I can suggest is to try passing "worksheets", as this has worked for me.&lt;BR /&gt;&lt;BR /&gt;I hope that's helpful.&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
    <pubDate>Mon, 04 Jan 2010 20:07:57 GMT</pubDate>
    <dc:creator>Michael8</dc:creator>
    <dc:date>2010-01-04T20:07:57Z</dc:date>
    <item>
      <title>Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847442#M64796</link>
      <description>I am having difficulties understanding how the COM automation fuction FUNCTION Worksheets_Add($OBJECT, ...) works. I have a test code that opens an Excel instance and then creates a new workbook. To add a new worksheet to this workbook, I use the following:&lt;BR /&gt;&lt;BR /&gt;WorkSheet = Worksheets_Add(WorkBooks, $STATUS=status)&lt;BR /&gt;call $WorkSheet_Activate(WorkSheet, $STATUS=status)&lt;BR /&gt;WorkSheet = $Workbook_GetActiveSheet(WorkBook, $STATUS=status)&lt;BR /&gt;call $WorkSheet_SetName(WorkSheet, 'SheetName', $STATUS=status)&lt;BR /&gt;&lt;BR /&gt;When I try "WorkSheet = WorkSheets_Add(WorkBook, $STATUS=status)", the function returns an error. It would make sense to me to add a worksheet to the current WorkBook and not the WorkBooks collection. &lt;BR /&gt;&lt;BR /&gt;Also, when I try to add a second sheet to the WorkBook, it always overwrites the first, no matter how I call the WorkSheets_Add function. I have tried using the 'After' argument assigned to the IDispatch pointer to the previous worksheet, but this does not seem to work. I think the error relates to the above code and the first and second worksheets are not members of the same workbook. Also note, I have created the WorkBooks collection but not the WorkSheets collection at this point. ??&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have made a surprising amount of progress in only a couple of hours at my first attempt at automating Excel through COM with IVF-10, but the process has been frusturating from a seemingly lack of documentation / information on the routines the Module Wizard creates. The F90VB documentation discussed in other posts has some high-level information but cannot help at the detailed level since most of these routines are hidden from the user.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for any assistance or thoughts.&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Jan 2010 12:25:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847442#M64796</guid>
      <dc:creator>anon0000</dc:creator>
      <dc:date>2010-01-04T12:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847443#M64797</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Hello:&lt;BR /&gt;&lt;BR /&gt;In the past, when using the Worksheets_Add function, I've passed the "worksheets" object as the first argument. Like you mentioned, there seems to be very little documentation about this, so I can't answer why "Workbooks" (somewhat) worked for you, but not "workbook". All I can suggest is to try passing "worksheets", as this has worked for me.&lt;BR /&gt;&lt;BR /&gt;I hope that's helpful.&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Jan 2010 20:07:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847443#M64797</guid>
      <dc:creator>Michael8</dc:creator>
      <dc:date>2010-01-04T20:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847444#M64798</link>
      <description>As I expected, the missing WorkSheets collection was the culprit. The following pseudocode outlines the process:&lt;BR /&gt;&lt;BR /&gt;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;call COMInitialize()&lt;BR /&gt;call COMCreateObject()&lt;BR /&gt;&lt;BR /&gt;WorkBooks = $Application_GetWorkbooks()&lt;BR /&gt;WorkBook = Workbooks_Add()&lt;BR /&gt;WorkSheets = $Application_GetWorksheets() &amp;lt;--- new code to generate WorkSheets collection&lt;BR /&gt;&lt;BR /&gt;! first worksheet&lt;BR /&gt;WorkSheet = Worksheets_Add()&lt;BR /&gt;call $WorkSheet_Activate()&lt;BR /&gt;WorkSheet = $Workbook_GetActiveSheet()&lt;BR /&gt;call $WorkSheet_SetName()&lt;BR /&gt;&lt;BR /&gt;! populate cells with data...&lt;BR /&gt;&lt;BR /&gt;! add second worksheet&lt;BR /&gt;WorkSheet = Worksheets_Add(WorkSheets, After="Pointer to first worksheet", ...)&lt;BR /&gt;call $WorkSheet_Activate()&lt;BR /&gt;WorkSheet = $Workbook_GetActiveSheet()&lt;BR /&gt;call $WorkSheet_SetName()&lt;BR /&gt;&lt;BR /&gt;! populate cells with data...&lt;BR /&gt;&lt;BR /&gt;! save &amp;amp; exit&lt;BR /&gt;call $Workbook_SaveAs(WorkBook, "file name as BSTR", ...)&lt;BR /&gt;call $Application_Quit()&lt;BR /&gt;&lt;BR /&gt;! release COM objects with ComReleaseObject()&lt;BR /&gt;call COMUninitialize()&lt;BR /&gt;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;&lt;BR /&gt;While running some trial-and-error tests, it appeared that if a new worksheet is created under the Workbooks collection, the new sheet is created under a new workbook, (e.g. Book1) and is not a part of the intended WorkBook. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Jan 2010 21:23:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847444#M64798</guid>
      <dc:creator>anon0000</dc:creator>
      <dc:date>2010-01-04T21:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847445#M64799</link>
      <description>With the test code functioning as I intended/expected, I tried to add the methods to a larger project by adding the appropriate code and regenerating the COM automation interface through the module wizard. The compiler returns an error in a class ID generated by the module wizard:&lt;BR /&gt;&lt;BR /&gt;TYPE (GUID), PARAMETER :: CLSID_QueryTable = &amp;amp;&lt;BR /&gt; GUID(#59191DA1, #EA47, #11CE, &amp;amp; &amp;lt;---&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;The errors are all for the indicated line above&lt;BR /&gt;1) Syntax error, found IDENTIFIER 'DA1' when expecting one of: .EQV. .NEQV. .XOR. .OR. .AND. .LT. &amp;lt; .LE. &amp;lt;= .EQ. == .NE. /= .GT. &amp;gt; ...	&lt;BR /&gt;2) This symbol must be a defined parameter or an argument of an inquiry function that evaluates to a compile-time constant.   [DA1]&lt;BR /&gt;3) This name does not have a type, and must have an explicit type.   [DA1]&lt;BR /&gt;&lt;BR /&gt;I have tried to use the module generated for the test code in the larger project with the same results (because the CLSID_QueryTable value is identical). If I comment the line out, I get an error about the generic routine COMCREATEOBJECT not having a specific routine. I do not think there error is directly caused by the CLSID becuase it works just fine in the test code.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Jan 2010 17:24:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847445#M64799</guid>
      <dc:creator>anon0000</dc:creator>
      <dc:date>2010-01-05T17:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847446#M64800</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Please attach the actual generated .f90 (ZIP it if it is large.)&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Jan 2010 18:01:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847446#M64800</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-01-05T18:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847447#M64801</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
I rebuilt identical modules for the test code and larger project to provide minimal functionality, with the same results.&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Jan 2010 18:45:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847447#M64801</guid>
      <dc:creator>anon0000</dc:creator>
      <dc:date>2010-01-05T18:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847448#M64802</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;The source compiles fine for me with 11.1 Update 4. Would you please attach the buildlog.htm showing the compile error?&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Jan 2010 18:49:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847448#M64802</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-01-05T18:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847449#M64803</link>
      <description>&lt;DIV style="margin: 0px; height: auto;"&gt;&lt;/DIV&gt;
I am using 10.1.4160.2005 with VS2005. One difference between the projects is /fpp, if I disable FPP, the synatx error disappears and I am left the error:&lt;BR /&gt;&lt;BR /&gt;Error: There is no matching specific subroutine for this generic subroutine call.   [COMCREATEOBJECT]	&lt;BR /&gt;&lt;BR /&gt;I can get around this by calling COMCreateObjectByProgID without /fpp to compile and debug. Also, since the generic interface to COMCreateObject seemed to disappear, I checked with other installations of the same IVF build and the IFCOM module was different. Does the use of COM Automation alter the include IFCOM or did I inadvertantly edit it?&lt;BR /&gt;&lt;BR /&gt;Any thoughts are greatly appreciated.&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Jan 2010 19:09:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847449#M64803</guid>
      <dc:creator>anon0000</dc:creator>
      <dc:date>2010-01-05T19:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Automation WorkSheets.Add method</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847450#M64804</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Ok - I can reproduce the error in 10.1 with /fpp. 11.1 is fine. I can imagine that the preprocessor got confused by the # syntax for the constants.&lt;BR /&gt;&lt;BR /&gt;The error you got indicates that the generic interface is there, but you have a call that doesn't match any of the signatures. IFCOM is installed as part of the compiler and does not get altered once installed.&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Jan 2010 20:34:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Excel-Automation-WorkSheets-Add-method/m-p/847450#M64804</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-01-05T20:34:33Z</dc:date>
    </item>
  </channel>
</rss>

