title: C++/CLI How to open Excel file using relative path?
body: <p>I am quite new to C++/CLI, and I am having trouble with opening an Excel file. This is my following code sample.</p>
  
  <pre><code>#using &lt;system.dll&gt;
  
  using namespace System;
  using namespace Microsoft::Office::Interop::Excel;
  
  String ^filename = gcnew String(L"Test.xlsx");
  try
  {
      Application^ exapp = gcnew ApplicationClass();
      Workbook^ wb = exapp-&gt;Workbooks-&gt;Open(filename,  Type::Missing, Type::Missing,
          Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing,
          Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing,
          Type::Missing, Type::Missing);
      Worksheet^  exws = safe_cast&lt;Worksheet^&gt;(exapp-&gt;ActiveSheet);
      exws-&gt;Cells[1, 1] = "Hello world";
      return true;
      Console::WriteLine("File Read Successfully");
  }
  catch (Exception ^e)
  {
      Console::WriteLine("Failed to read File");
      Console::WriteLine(e);
      return false;
  };
  </code></pre>
  
  <p>Whenever I run it, it will always throw <code>FileNotFoundException</code>, even though the Excel file is right next to Test.exe, unless I change filename back to fullpath like <code>C:\Users\NGU0085\Documents\Visual Studio 2013\Projects\Test\Debug\Test.xlsx</code></p>
  
  <p>Is there any way to open an Excel file using relative path?</p>