Advertisement
adilima

Opening Excel Workbook using C++/CLI

Mar 2nd, 2016
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. Workbook^ LPOpen(Excel::Application^ xl, String^ strPath)
  2. {
  3.     try {
  4.         String^ strFullPath = System::IO::Path::GetFullPath(strPath);
  5.         Workbook^ wb = xl->Workbooks->Open(strFullPath,
  6.                 Type::Missing, Type::Missing,
  7.                 Type::Missing, Type::Missing,
  8.                 Type::Missing, Type::Missing,
  9.                 Type::Missing, Type::Missing,
  10.                 Type::Missing, Type::Missing,
  11.                 Type::Missing, Type::Missing,
  12.                 Type::Missing, Type::Missing);
  13.         return wb;
  14.     }
  15.     catch (Exception^ e) {
  16.         Console::Write("{0}\n", e->Message);
  17.     }
  18.     return nullptr;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement