Re: Linking to Mathematica Kernel from Excel
- To: mathgroup at smc.vnet.net
- Subject: [mg59594] Re: Linking to Mathematica Kernel from Excel
- From: stevekass at gmail.com
- Date: Sat, 13 Aug 2005 03:26:24 -0400 (EDT)
- References: <200508100658.CAA04724@smc.vnet.net><ddf5bp$ol0$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Murray, Can you verify that "Mathematica Link for Excel" works correctly with recent versions of Mathematica? I just tried installing Episoft's other offering, Mathematica for ActiveX, and it is not working. The files in that product are all dated from 1996-2000, and I want to find out if it still works. If you are using it successfully, can you mention whether you are doing this via a network license for Mathematica? I'm getting a $NoLink result, which suggests that Episoft's product and NetworkMathematica aren't playing well together. Steve Kass Drew University skass at drew.edu Murray Eisenberg wrote: > If you'd rather pay than play, you could use the Wolfram add-on > application "Mathematica Link for Excel". See: > http://www.wolfram.com/products/applications/excel_link/ > > plizak wrote: > > I'm trying to write code to link to Mathematica automatically from > > within MS Excel. Here is the code I have so far (below - It's VBA > > code). > > > > It does not work when I first open Excel, but if I have already > > connected to the kernel prior and want to reconnect then it works. Do > > I have to point to the location of the kernel? If so how? > > > > Also, Am I clearing variables properly? What command should I use in > > Mathematica to clear all variables??? > > > > Thanks in advance, > > Peter > > > > ------ VBA code below -------------------------------------------- > > > > > > > > ' If there is an error, go to "deal" > > On Error GoTo deal > > > > result = Application.Run("Mathematica", "$Version") > > Debug.Print result > > > > ' If there is no link, then connect to the Kernel > > If result = "$NoLink" Then > > ' Connect to the mathematica Kernel > > Debug.Print "Connecting to Mathematica" > > Application.Run "LinkOpenOrClose" > > > > ' If there is a link already, clear all variables > > Else > > ' Clear the contents of the mathematica kernel > > Debug.Print "Clearing Memory" > > FunInput = "Clear[ ""Global `*""]" > > result = Application.Run("Mathematica", FunInput) > > Debug.Print result > > End If > > > > ' check the version just to make sure we have a link > > result = Application.Run("Mathematica", "$Version") > > > > If result = "$NoLink" Then > > MsgBox ("Error connecting to Mathematica Kernel. Please verify > > Mathematica is installed and available and please try again.") > > End If > > > > > > Exit Sub > > > > ' do the following if we encounter an error > > deal: > > > > Debug.Print "Error Linking Mathematica: Error # ", Err > > If Err = 1004 Then > > result = Application.Run("Mathematica", "LinkOpenOrClose") > > End If > > > > > > -- > Murray Eisenberg murray at math.umass.edu > Mathematics & Statistics Dept. > Lederle Graduate Research Tower phone 413 549-1020 (H) > University of Massachusetts 413 545-2859 (W) > 710 North Pleasant Street fax 413 545-1801 > Amherst, MA 01003-9305
- Follow-Ups:
- Re: Re: Linking to Mathematica Kernel from Excel
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Re: Linking to Mathematica Kernel from Excel
- References:
- Linking to Mathematica Kernel from Excel
- From: "plizak" <plizak@gmail.com>
- Linking to Mathematica Kernel from Excel