メソッドに貼り付けるだけで機能するソースコードを多数用意しています。
Excelのバージョンを取得する
Excelのバージョンを取得します。
このプロパティによって取得できる値は以下の通りです。
| Excel | バージョン |
| 2010 | 14.0 |
| 2007 | 12.0 |
| 2003 | 11.0 |
| 2002 | 10.0 |
| 2000 | 9.0 |
| 97 | 8.0 |
取得方法は以下のようになります。
{
// Excel操作用オブジェクト
Application xlApp = null;
// Excelアプリケーション生成
xlApp = new Application();
// ◆バージョン番号をメッセージボックスに表示◆
// Versionプロパティ
System.Windows.Forms.MessageBox.Show(xlApp.Version);
// Excelアプリケーションを解放
xlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
}