I want to pass command line arguments to MS Office programs (Excel, Word, Powerpoint) like below,

"C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.exe" "c:\Book1.xlsx" /e/<arg1>

To able to access them in MS Office plugin event functions

private void button1_Click(object sender, RibbonControlEventArgs e){}

  • You can create a .bat with whatever arguments you wish. What's the question? – Raystafarian Aug 12 '15 at 8:29
  • Do you mean you want a file(call it argumentsfile) that contains a list of filenames, and for each filename, some parameters. And when you double click a file blah.xls then it opens it with those parameters that you have for specified that file blah.xls should be opened with? i'm not sure how that'd be done. Maybe it'd involve associating excel files with a program other than excel, and that program will then execute the file in excel, with the correct arguments – barlop Aug 12 '15 at 14:40
  • @Raystafarian Did you not read where he wrote "double clicks the Book1.xlsx" – barlop Aug 12 '15 at 14:44
  • @Raystafarian also, a bat file wouldn't be great for giving him a choice of what file to open, if he has to browse to that file. Are you suggesting a bat file for every single xls file? Or a menu for all xls files.. Maybe a it could somehow give a menu for all xls files in the directory – barlop Aug 12 '15 at 14:46
  • @barlop yes, I did miss the "click on book1" part. whoops – Raystafarian Aug 12 '15 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.