Skip to content

Instantly share code, notes, and snippets.

@TSKGunGun
Created December 15, 2016 23:52
Show Gist options
  • Save TSKGunGun/73f9fc99c318c5d22fc30c2e1a23c5ee to your computer and use it in GitHub Desktop.
Save TSKGunGun/73f9fc99c318c5d22fc30c2e1a23c5ee to your computer and use it in GitHub Desktop.
VBAでC#のdllを使うサンプル
using System;
using System.Text;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace VBA_SampleAddin
{
[ComVisible(true)]
public interface IVBA_Addin
{
[Description("HelloWorldを出力します。")]
string HelloWorld(string name);
}
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public class VBA_Addin : IVBA_Addin
{
/// <summary>
/// HelloWorld
/// </summary>
public string HelloWorld(string name)
{
string msg = "Hello World! " + name;
return msg;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment