title: Getting STA error when try to open OpenFileDialog box in Excel addin project
body: <p>I have created Excel addin project using Visual Studio to insert a data into database.</p>
  <p>The problem is I'm unable to open a File upload box in this.</p>
  <p>I am getting an error.</p>
  <p>My code:</p>
  <pre><code> [ObsoleteAttribute()]
          [STAThread]
          private void Save(ProgressBarForm pBar)
          {
    OpenFileDialog openFileDialog1 = new OpenFileDialog();
                          DialogResult result =  openFileDialog1.ShowDialog();
                          if (result == DialogResult.OK)
                          {
  //execute code
  </code></pre>
  <p>I tried to give attribute to Save method also then also it is giving me the error below:</p>
  <p><img src="https://i.stack.imgur.com/DJnBT.png" alt="enter image description here" /></p>