C#で、エクセルファイルをアクセスしようとしております
下記のサイトを、参考にさせて頂きアクセスのプログラムを
作成しようとしておりますが、ビルドをかけると下記のエラーが
発生します。対処の方法をご教示いただけないでしょうか
Applicationの箇所が赤アンダバーがついており、エラー内容は
「エラー CS0104 'Application' は、'Microsoft.Office.Interop.Excel.Application' と 'System.Windows.Forms.Application' 間のあいまいな参照です。」
参考にしたサイトはこちらです
http://qiita.com/kyama0922/items/f0c6449d8734889d1e83
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Runtime.InteropServices; using Microsoft.Office.Interop.Excel; using System.Windows.Forms; namespace EXCEL_TEST3 { static class Program { /// <summary> /// アプリケーションのメイン エントリ ポイントです。 /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application(); //エクセルを非表示 ExcelApp.Visible = false;
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/01/07 04:08