要約
・Microsoft.Office.Interop.なんたら、をusing
・DLLをさがせ
・DLLのバージョンを確認しろ
・コンパイル時にDLLをrefしろ
ソース
using System;
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application excelApp = new Excel.Application();
using System;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
PowerPoint.Application pptApp = new PowerPoint.Application();
コンパイル
c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe
/target:exe
/reference:"C:\Path\
Microsoft.Office.Interop.Excel.dll"
Program.cs
/reference:OFFICE.DLL;Microsoft.Office.Interop.PowerPoint.dll
DLLのバージョン確認
powershell (Get-Item "C:\Users\Office.dll").VersionInfo.ProductVersion
PC内のDLLの探索
c:\> dir /s OFFICE.DLL
c:\Program Files\Microsoft Office\root\Office16\ADDINS\Microsoft Power Query for Excel Integrated\bin のディレクトリ
2022/08/19 13:15 458,544 Office.dll
1 個のファイル 458,544 バイト