<?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 VBA/VB will complain about in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133167#M134886</link>
    <description>&lt;P&gt;VBA/VB will complain about the DLL you're referencing directly when what it really can't find is a dependent DLL. If you built the Fortran DLL as a Debug configuration but ran Excel outside of VS, you'll get this error. You can 1) Build a Release configuration if you're not trying to debug the DLL, 2) Link against the static libraries, 3) Invoke Excel from inside VS by specifying it in the Debugging property page of the DLL project as the command to run.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Apr 2019 00:52:37 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2019-04-23T00:52:37Z</dc:date>
    <item>
      <title>Call DLL from Excel</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133166#M134885</link>
      <description>&lt;P&gt;I know this has been addressed before, but the previous info doesn't seem to help.&lt;/P&gt;&lt;P&gt;I am trying to run the test code that comes with Intel Fortran, the xltest.xls + Fcall.f90 example.&lt;/P&gt;&lt;P&gt;Here is the Fortran code:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;subroutine FortranCall (r1, num)
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS:"FortranCall" :: FortranCall
integer, intent(in) :: r1
character(10), intent(out) :: num
!DEC$ ATTRIBUTES REFERENCE :: num

num = ''
write (num,'(i0)') r1 * 2

return
end subroutine FortranCall&lt;/PRE&gt;

&lt;P&gt;and here is the VBA module code:&lt;/P&gt;

&lt;PRE class="brush:; class-name:dark; wrap-lines:false;"&gt;Declare PtrSafe Sub FortranCall Lib "D:\Misc\Excel\fcall.dll" (r1 As Long, ByVal num As String)&lt;/PRE&gt;

&lt;P&gt;(I added PtrSafe, but it doesn't make any difference).&lt;/P&gt;
&lt;P&gt;When I build the DLL with IVF 2013 and click the button to try to run this in Excel I get:&lt;/P&gt;
&lt;P&gt;Run-time error '48':&lt;/P&gt;
&lt;P&gt;File not found: D:\Misc\Excel\fcall.dll&lt;/P&gt;
&lt;P&gt;although of the course the DLL is there.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 00:40:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133166#M134885</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T00:40:43Z</dc:date>
    </item>
    <item>
      <title>VBA/VB will complain about</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133167#M134886</link>
      <description>&lt;P&gt;VBA/VB will complain about the DLL you're referencing directly when what it really can't find is a dependent DLL. If you built the Fortran DLL as a Debug configuration but ran Excel outside of VS, you'll get this error. You can 1) Build a Release configuration if you're not trying to debug the DLL, 2) Link against the static libraries, 3) Invoke Excel from inside VS by specifying it in the Debugging property page of the DLL project as the command to run.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 00:52:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133167#M134886</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-04-23T00:52:37Z</dc:date>
    </item>
    <item>
      <title>Thanks for responding, Steve.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133168#M134887</link>
      <description>&lt;P&gt;Thanks for responding, Steve.&amp;nbsp; I am building a Release config., and running Excel outside VS.&amp;nbsp; Should I try linking against a static library?&amp;nbsp; If so, is that just a matter of building the static library then specifying it in that module declaration line?&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;I tried building a static library, but the error message is unchanged.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 01:01:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133168#M134887</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T01:01:00Z</dc:date>
    </item>
    <item>
      <title>In my apps, I have found it</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133169#M134888</link>
      <description>&lt;P&gt;In my apps, I have found it best to include all the libraries as a static build, as this ensures that the correct version is always available for users.&lt;/P&gt;&lt;P&gt;Also, any string arguments passed from Excel should be filled to the correct length required for Fortran, e.g. using SPACE(20) or similar in the VBA code.&lt;/P&gt;&lt;P&gt;Be aware also, that the case of the function name in the Alias statement must be the same as in the VBA call, otherwise the function will not be found.&lt;/P&gt;&lt;P&gt;Depending on the version of Excel you are using, and the corresponding version of VBA, then you may or may not need the PtrSafe attribute:&lt;/P&gt;&lt;P&gt;I use the following ...&lt;/P&gt;&lt;P&gt;#If VBA7 Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; #If Win64 Then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Private Declare PtrSafe Sub MyFunc Lib "MyDLL64.dll" (Value As Double, ByVal Units As String)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; #Else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Private Declare PtrSafe Sub MyFunc Lib "MyDLL.dll" (Value As Double, ByVal Units As String)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; #End If&lt;BR /&gt;#Else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Private Declare Sub MyFunc&amp;nbsp;Lib "MyDLL.dll" (Value As Double, ByVal Units As String)&lt;BR /&gt;#End If&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 03:28:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133169#M134888</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2019-04-23T03:28:12Z</dc:date>
    </item>
    <item>
      <title>Thanks David.  Following your</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133170#M134889</link>
      <description>&lt;P&gt;Thanks David.&amp;nbsp; Following your suggestion, I have:&lt;/P&gt;&lt;P&gt;#If VBA7 Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #If Win64 Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare PtrSafe Sub FortranCall Lib "D:\Misc\Excel\fcall_lib.lib" (r1 As Long, ByVal num As String)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare PtrSafe Sub FortranCall Lib "D:\Misc\Excel\fcall_lib.lib" (r1 As Long, ByVal num As String)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #End If&lt;BR /&gt;#Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare Sub MyFunc Lib "D:\Misc\Excel\fcall_lib.lib" (r1 As Long, ByVal num As String)&lt;BR /&gt;#End If&lt;/P&gt;&lt;P&gt;then the sub is:&lt;/P&gt;&lt;P&gt;Private Sub CommandButton1_Click()&lt;BR /&gt;Dim r1 As Long&lt;BR /&gt;Dim num As String * 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r1 = 123&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call FortranCall(r1, num)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextBox1.Text = "Answer is " &amp;amp; num&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;The Fortran is unchanged, i.e. the Alias name is 'FortranCall'.&amp;nbsp; This has changed the error message, implying (possibly) that the .lib is now found:&lt;/P&gt;&lt;P&gt;Compile error:&lt;/P&gt;&lt;P&gt;Sub or Function not defined.&lt;/P&gt;&lt;P&gt;The highlighted line is:&lt;/P&gt;&lt;P&gt;Call FortranCall(r1, num)&lt;/P&gt;&lt;P&gt;Considering that this is an example supplied with the Intel Fortran compiler, one might expect it to work.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 03:52:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133170#M134889</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T03:52:55Z</dc:date>
    </item>
    <item>
      <title>As Steve mentioned, the error</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133171#M134890</link>
      <description>&lt;P&gt;As Steve mentioned, the error might be to some other DLL, not the one you are calling.&amp;nbsp; You might need to check using dependency walker to determine which DLL is missing.&lt;/P&gt;&lt;P&gt;The other one is to try is to define r1 as a single element array on the Fortran side.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 04:17:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133171#M134890</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2019-04-23T04:17:51Z</dc:date>
    </item>
    <item>
      <title>If you can find my post from</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133172#M134891</link>
      <description>&lt;P&gt;If you can find my post from a couple of years ago, I think I posted a full example (I couldn't find it earlier)&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 04:19:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133172#M134891</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2019-04-23T04:19:06Z</dc:date>
    </item>
    <item>
      <title>David, since the error</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133173#M134892</link>
      <description>&lt;P&gt;David, since the error references the Fortran subroutine, it's hard to see that the problem might be a missing DLL.&amp;nbsp; In any case, how would I use DW to find out what Excel is missing?&amp;nbsp; I don't have a .exe.&amp;nbsp; You did see that (following Steve's suggestion) I'm now linking the static library?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 04:40:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133173#M134892</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T04:40:00Z</dc:date>
    </item>
    <item>
      <title>DW will tell you whether your</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133174#M134893</link>
      <description>&lt;P&gt;DW will tell you whether your DLL is failing to find dependent DLL.&amp;nbsp; Make sure you open the copy of the DLL that Excel is loading, not one in your VS folder.&lt;/P&gt;&lt;P&gt;I don't trust the Excel error messages; they can say that the function is missing simply because there was an error when the function call was made (e.g. the arguments trampled over the stack, etc).&lt;/P&gt;&lt;P&gt;I don't have REFERENCE in my !DEC$ declaration for the entry point, only DLLEXPORT, STDCALL and ALIAS.&amp;nbsp; I use REFERENCE for the string arguments in a separate declaration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 04:49:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133174#M134893</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2019-04-23T04:49:00Z</dc:date>
    </item>
    <item>
      <title>Sorry, David, I don't know</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133175#M134894</link>
      <description>&lt;P&gt;Sorry, David, I don't know what this means: "Make sure you open the copy of the DLL that Excel is loading, not one in your VS folder."&lt;/P&gt;&lt;P&gt;What DLL is Excel loading?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 05:22:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133175#M134894</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T05:22:04Z</dc:date>
    </item>
    <item>
      <title>According to your code, you</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133176#M134895</link>
      <description>&lt;P&gt;According to your code, you are using&amp;nbsp;"D:\Misc\Excel\fcall.dll"&lt;/P&gt;&lt;P&gt;Run Dependency Walker on that DLL to check that all required DLL's are able to be loaded.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is possible that the DLL you build in VS is OK because of the extra folders in the PATH while in VS; when you get to Excel if not all of the required routines are linked statically, then it is possible that there is still a DLL that Excel can't find, resulting in the error when you attempt to call your function.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 05:59:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133176#M134895</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2019-04-23T05:59:58Z</dc:date>
    </item>
    <item>
      <title>David, as I wrote a couple of</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133177#M134896</link>
      <description>&lt;P&gt;David, as I wrote a couple of times, I changed to using the static library, as Steve suggested. This is from #5:&lt;/P&gt;&lt;P&gt;Thanks David.&amp;nbsp; Following your suggestion, I have:&lt;/P&gt;&lt;P&gt;#If VBA7 Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #If Win64 Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare PtrSafe Sub FortranCall Lib "D:\Misc\Excel\fcall_lib.lib" (r1 As Long, ByVal num As String)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare PtrSafe Sub FortranCall Lib "D:\Misc\Excel\fcall_lib.lib" (r1 As Long, ByVal num As String)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #End If&lt;BR /&gt;#Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare Sub MyFunc Lib "D:\Misc\Excel\fcall_lib.lib" (r1 As Long, ByVal num As String)&lt;BR /&gt;#End If&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 06:37:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133177#M134896</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T06:37:30Z</dc:date>
    </item>
    <item>
      <title>In all my apps I still use a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133178#M134897</link>
      <description>&lt;P&gt;In all my apps I still use a DLL which is called from Excel.&lt;/P&gt;&lt;P&gt;However, this DLL is built using the Multithreaded option (/libs:static /threads).&amp;nbsp; This means that the required Fortran libraries get incorporated into your DLL, and so no further dependencies should be needed.&lt;/P&gt;&lt;P&gt;So&lt;/P&gt;&lt;P&gt;1. Create a DLL using the static libraries&lt;/P&gt;&lt;P&gt;2. Refer to the DLL in the VBA Lib statements (not to the LIB)&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 07:41:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133178#M134897</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2019-04-23T07:41:35Z</dc:date>
    </item>
    <item>
      <title>OK, I see.  I have build with</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133179#M134898</link>
      <description>&lt;P&gt;OK, I see.&amp;nbsp; I have build with Multithreaded libraries (/libs:static /threads), and I get the same error - Sub or Function not defined.&amp;nbsp; DW doesn't show that fcall.dll has any missing DLLs.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 08:24:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133179#M134898</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T08:24:00Z</dc:date>
    </item>
    <item>
      <title>Gib,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133180#M134899</link>
      <description>&lt;P&gt;Gib,&lt;/P&gt;&lt;P&gt;Can you show me your source code, or at least&lt;/P&gt;&lt;P&gt;1. the DEC$ statement&lt;/P&gt;&lt;P&gt;2. the Declare Lib statement in the VBA code&lt;/P&gt;&lt;P&gt;3. the actual function call in VBA&lt;/P&gt;&lt;P&gt;While it doesn't seem likely from the discussion to date, I suspect that there is a case mismatch somewhere between the function name in the VBA and in the DLL.&lt;/P&gt;&lt;P&gt;You could also check the DLL entry points in the DW output to make sure that the names and case match what you're expecting.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 12:09:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133180#M134899</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2019-04-23T12:09:49Z</dc:date>
    </item>
    <item>
      <title>"Sub or function not defined"</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133181#M134900</link>
      <description>&lt;P&gt;"Sub or function not defined" is not the same as "DLL not found"! So now it found all the DLLs, and you just have a name mismatch. David's requests are helpful in diagnosing the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:44:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133181#M134900</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-04-23T13:44:04Z</dc:date>
    </item>
    <item>
      <title>Try building your Fortran DLL</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133182#M134901</link>
      <description>&lt;P&gt;Try building your Fortran DLL project in the Win32 Release configuration with the &lt;STRONG&gt;CVF calling convention (/iface:cvf)&lt;/STRONG&gt; and library option set to "&lt;STRONG&gt;Debug Multithreaded&lt;/STRONG&gt;". I find this to be the most reliable way to use IVF DLLs in Excel. I say "most reliable" because while the example provided by Intel works, if the same settings are used for my own DLLs, then Excel crashes in some cases.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;@Steve Lionel&lt;/STRONG&gt;&amp;nbsp;In recent times (i.e. after IVF 17 or 18), the DLLs built under the debug configuration do not work any more in Excel or cause crashes. This was not the case prior to that. I don't know whether this is a change in IVF, Excel, MSVS or a combination thereof.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 16:42:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133182#M134901</guid>
      <dc:creator>avinashs</dc:creator>
      <dc:date>2019-04-23T16:42:01Z</dc:date>
    </item>
    <item>
      <title>There's nothing magic about</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133183#M134902</link>
      <description>&lt;P&gt;There's nothing magic about the settings in the example project. I'll try the samples again and see how they work for me.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 18:50:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133183#M134902</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-04-23T18:50:05Z</dc:date>
    </item>
    <item>
      <title>Steve, as I showed in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133184#M134903</link>
      <description>&lt;P&gt;Steve, as I showed in response #5, the error message changed when I used David's suggestion for the declaration in VBA.&lt;/P&gt;&lt;P&gt;David, I previously showed all the code - the only change is in the Declare code you provided.&amp;nbsp; Note that I didn't write this, it is the Intel example.&amp;nbsp; Here it all is again:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;subroutine FortranCall (r1, num)
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS:"FortranCall" :: FortranCall
integer, intent(in) :: r1
character(10), intent(out) :: num
!DEC$ ATTRIBUTES REFERENCE :: num
num = ''
write (num,'(i0)') r1 * 2
return
end subroutine FortranCall&lt;/PRE&gt;

&lt;P&gt;The VBA sub:&lt;/P&gt;
&lt;P&gt;Private Sub CommandButton1_Click()&lt;BR /&gt;Dim r1 As Long&lt;BR /&gt;Dim num As String * 10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r1 = 123&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num = Space(10)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call FortranCall(r1, num)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextBox1.Text = "Answer is " &amp;amp; num&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;End Sub&lt;/P&gt;
&lt;P&gt;The VBA declaration code:&lt;/P&gt;
&lt;P&gt;#If VBA7 Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #If Win64 Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare PtrSafe Sub FortranCall Lib "D:\Fortran\Excel\Fcall.dll" (r1 As Long, ByVal num As String)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare PtrSafe Sub FortranCall Lib "D:\Fortran\Excel\Fcall.dll" (r1 As Long, ByVal num As String)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #End If&lt;BR /&gt;#Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Declare Sub MyFunc Lib "D:\Fortran\Excel\Fcall.dll" (r1 As Long, ByVal num As String)&lt;BR /&gt;#End If&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 20:37:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133184#M134903</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T20:37:00Z</dc:date>
    </item>
    <item>
      <title>avinashs, implementing your</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133185#M134904</link>
      <description>&lt;P&gt;avinashs, implementing your suggestion didn't change the error message.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 20:41:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Call-DLL-from-Excel/m-p/1133185#M134904</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2019-04-23T20:41:29Z</dc:date>
    </item>
  </channel>
</rss>

