<?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 COM Workbook_Close subroutine in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809912#M42173</link>
    <description>If you look at the definition of type VARIANT in IFWINTY you'll see this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fortran]          TYPE VARIANT
            SEQUENCE
                INTEGER*2       VT
                INTEGER*2       RESERVED1
                INTEGER*2       RESERVED2
                INTEGER*2       RESERVED3
                RECORD /VARIANT_UNION/ VU
          END TYPE VARIANT
          INTEGER*2, PARAMETER :: VARIANT_BOOL_TRUE = -1
          INTEGER*2, PARAMETER :: VARIANT_BOOL_FALSE = 0
          TYPE (VARIANT) :: OPTIONAL_VARIANT[/fortran]&lt;/PRE&gt; This tells me that you want something like this:&lt;BR /&gt;&lt;BR /&gt;SaveChanges%VT = VARIANT_BOOL_FALSE&lt;BR /&gt;&lt;BR /&gt;I have not tested this.</description>
    <pubDate>Fri, 21 Oct 2011 14:51:52 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2011-10-21T14:51:52Z</dc:date>
    <item>
      <title>COM Workbook_Close subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809911#M42172</link>
      <description>I am unsure about how to use some of the features in the Workbook_Close subroutine of the COM interface that is generated by the Fortran Module Wizard. Specifically, the subroutine is defined as:&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;SUBROUTINE $Workbook_Close($OBJECT, SaveChanges, Filename, RouteWorkbook, $STATUS)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I would like to set the SaveChages variable to false. I think that this will avoid an Excel prompt that asks whether I would like to save changes to an excel file each time I access it from Fortran.&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The SaveChanges variable is defined as:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;TYPE (VARIANT), INTENT(IN), OPTIONAL	:: SaveChanges&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I realise that I should add code into my mainprogram that sets up a pointer, but am unsure what this code should be. The AutoDice example indicates that the following code should be used in relation to a string variant:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;vBSTR1%VT = VT_BSTR&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;		bstr1 = ConvertStringToBSTR("A2")&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;		vBSTR1%VU%PTR_VAL = bstr1&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Unfortunately, I suspect that the SaveChanges variable should be defined as a logical, and I have been unable to find an example of how to code this up.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Many thanks in advance for any help.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 19 Oct 2011 04:11:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809911#M42172</guid>
      <dc:creator>jvandeven</dc:creator>
      <dc:date>2011-10-19T04:11:54Z</dc:date>
    </item>
    <item>
      <title>COM Workbook_Close subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809912#M42173</link>
      <description>If you look at the definition of type VARIANT in IFWINTY you'll see this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fortran]          TYPE VARIANT
            SEQUENCE
                INTEGER*2       VT
                INTEGER*2       RESERVED1
                INTEGER*2       RESERVED2
                INTEGER*2       RESERVED3
                RECORD /VARIANT_UNION/ VU
          END TYPE VARIANT
          INTEGER*2, PARAMETER :: VARIANT_BOOL_TRUE = -1
          INTEGER*2, PARAMETER :: VARIANT_BOOL_FALSE = 0
          TYPE (VARIANT) :: OPTIONAL_VARIANT[/fortran]&lt;/PRE&gt; This tells me that you want something like this:&lt;BR /&gt;&lt;BR /&gt;SaveChanges%VT = VARIANT_BOOL_FALSE&lt;BR /&gt;&lt;BR /&gt;I have not tested this.</description>
      <pubDate>Fri, 21 Oct 2011 14:51:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809912#M42173</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-10-21T14:51:52Z</dc:date>
    </item>
    <item>
      <title>COM Workbook_Close subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809913#M42174</link>
      <description>Worked perfectly - thanks, once again, Steve.</description>
      <pubDate>Thu, 27 Oct 2011 08:06:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809913#M42174</guid>
      <dc:creator>jvandeven</dc:creator>
      <dc:date>2011-10-27T08:06:06Z</dc:date>
    </item>
    <item>
      <title>COM Workbook_Close subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809914#M42175</link>
      <description>Correct me if I'm wrong, but I think the VARIANT_BOOL_xxx constant should be assigned to the component that represents the variant's value, with the type being set to VT_BOOL, i.e.&lt;BR /&gt;&lt;BR /&gt;SaveChanges%VT = VT_BOOL&lt;BR /&gt;SaveChanges%VU%BOOL_VAL = VARIANT_BOOL_FALSE&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Oct 2011 10:32:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809914#M42175</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2011-10-27T10:32:05Z</dc:date>
    </item>
    <item>
      <title>COM Workbook_Close subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809915#M42176</link>
      <description>Ha - I was just about to update this, as the code compiled, but didn't work. You are right - a shame I didn't read your message sooner, as I have just spent 30 minutes sorting this out.</description>
      <pubDate>Thu, 03 Nov 2011 04:51:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809915#M42176</guid>
      <dc:creator>jvandeven</dc:creator>
      <dc:date>2011-11-03T04:51:04Z</dc:date>
    </item>
    <item>
      <title>SUBROUTINE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809916#M42177</link>
      <description>&lt;P&gt;[fortran]&lt;/P&gt;

&lt;P&gt;SUBROUTINE CloseExelwithoutSaving(status)&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; IMPLICIT NONE&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; INTEGER(4),intent(out) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :: status&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; type(VARIANT) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:: SaveChanges&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; status=-1&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; if(workbook.eq.0) return&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; SaveChanges%VT = VT_BOOL&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; SaveChanges%VU%BOOL_VAL = VARIANT_BOOL_FALSE&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; !call $Workbook_Close(workbook, SaveChanges, Filename, RouteWorkbook, $STATUS)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; call $Workbook_Close(workbook, SaveChanges=SaveChanges, $STATUS=status)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; if(status.ne.0) return&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; call Workbooks_Close(workbooks, status)&lt;BR /&gt;
	END SUBROUTINE CloseExelwithoutSaving&lt;/P&gt;

&lt;P&gt;[/fortran]&lt;/P&gt;

&lt;P&gt;Anyone solve this problem?&amp;nbsp;&amp;nbsp;With the code above (the undeclared stuff is from the module variables BTW) the&amp;nbsp;$Workbook_Close closes the worksheet leaving and empty excel window. Adding the&amp;nbsp;Workbooks_Close closes the excel session but *only* when I exit the application that created it!&lt;/P&gt;

&lt;P&gt;aNY&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2013 22:28:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/COM-Workbook-Close-subroutine/m-p/809916#M42177</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2013-12-04T22:28:29Z</dc:date>
    </item>
  </channel>
</rss>

