Is there any easy way to show the ExcelDna Log?

Mar 5, 2010 at 11:48 AM

Is there any easy way to show the ExcelDna Log? Perhaps a toolbar button?

 

Coordinator
Mar 8, 2010 at 9:11 AM

Sure - you can easily add a button to do that. I attach a .dna file that will do this.

--Govert--

<DnaLibrary Language="C#">
<Reference AssemblyPath="System.Windows.Forms.dll" />
<![CDATA[
using ExcelDna.Integration;
public class Test
{
[ExcelCommand(MenuText="Show Log Window")] 
public static void ShowLog() 
ExcelDna.Logging.LogDisplay.LogDisplayForm.Show();
}
]]>
</DnaLibrary>

 

<DnaLibrary Language="C#">
<Reference AssemblyPath="System.Windows.Forms.dll" />
<![CDATA[
using ExcelDna.Integration;
public class Test
{

	[ExcelCommand(MenuText="Show Log Window")] 
	public static void ShowLog() 
	{ 
		ExcelDna.Logging.LogDisplay.LogDisplayForm.Show();
	} 
}
]]>
</DnaLibrary>

 

 

 

Mar 9, 2010 at 1:08 PM

Thank you! That works flawlessly ;)

Now if only someone were to write a syntax highlighting, intellisense capable editor for .dna files :)

 

Coordinator
Mar 9, 2010 at 1:27 PM

[Coming soon....]

Oct 27, 2014 at 11:41 PM
Edited Oct 27, 2014 at 11:49 PM
when I try this I get this error:
"To load under the 64-bit version of Excel, this add-in must specify that version 4 of the Microsoft.NET framework should be used....."

So then I change the 1st line of the DNA file to:
<DnaLibrary Language="C#" RuntimeVersion="v4.0">
And then I get this error:
There were errors when compiling project: 
c:\Users\Pro Gamer\AppData\Local\Temp\b0cvrq5j.0.cs(8,31) : error CS0117: 'ExcelDna.Logging.LogDisplay' does not contain a definition for 'LogDisplayForm'
I've then changed the code again, removing the LogDisplayForm, so that my final code looks like this:
<DnaLibrary Language="C#" RuntimeVersion="v4.0">
<Reference AssemblyPath="System.Windows.Forms.dll" />
<![CDATA[
using ExcelDna.Integration;
public class Test
{
    [ExcelCommand(MenuText="Show Log Window")] 
    public static void ShowLog() 
    { 
        ExcelDna.Logging.LogDisplay.Show();
    } 
}
]]>
</DnaLibrary>
and this seems to work - the menu appears in excel, and the log is shown when I click on it.

However when I try to add the code to open my xll and show me the log of that, then menu doesn't appear - any idea why? I'm trying this:
<DnaLibrary Language="C#" RuntimeVersion="v4.0">
<ExternalLibrary Path="myFuncs20.dll"/>
<Reference AssemblyPath="System.Windows.Forms.dll" />
<![CDATA[
using ExcelDna.Integration;
public class Test
{
    [ExcelCommand(MenuText="Show Log Window")] 
    public static void ShowLog() 
    { 
        ExcelDna.Logging.LogDisplay.Show();
    } 
}
]]>
</DnaLibrary>
Thanks
Coordinator
Oct 28, 2014 at 8:00 AM
Hi,

I presume there is some unexpected error loading your "myFuncs20.dll" assembly. It might have some dependency that fails to load.
It also sounds like you switched to 64-bit. Did this work before on the 32-bit Excel and .NET 2.0? Some assemblies need extra information in the .config file to load under .NET 4 - especially if it is a mixed assembly with both native and managed code (the flag is called useLegacyActivationPolicy or something).

I suggest you attach the Visual Studio debugger to your Excel session before loading the add-in. Then check for any problems in the Output display.

Otherwise you might want to start from a simple add-in that works, and build it up again to where you are now.

-Govert
Oct 28, 2014 at 8:10 AM
Thanks Govert,
I've always used 64-bit, and it has worked well up until today, when the xll/dll has failed to load with no messages, hence I was looking for logging.
I have got it to work now though - reinstalled excelDNA, including copying over the latest xll.
Thanks
Ben