suki_ash Posted February 22, 2007 Posted February 22, 2007 (edited) private bool OpenWord() { try { wordApp = new ApplicationClass(); tname = (object) templateFileName; wordApp.Visible = false; //wordDoc = wordApp.Documents.Open(ref tname, ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing); //for Word 2000 wordDoc = wordApp.Documents.Open(ref tname, ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing); //for Word 2003 return true; } catch (Exception ex) { myLogFile.WriteLine("Error while attempting to open the template." + ex.Message + ex.StackTrace ); cleanUp(); wordApp = null; return false; } } This is my method for opening a word document, but for wordApp.Documents.Open() method will take the parameters depending on the version installed in the machine, so here how can I determine which method to call at runtime. Please help me.... Thanks, Subhosh. Edited February 22, 2007 by PlausiblyDamp Quote
amir100 Posted February 23, 2007 Posted February 23, 2007 I believe you should consult some reference on Interop Assemblies so that you don't have to worry about the difference in Word version. I have experience the same problem with you. I tried to read some reference about Interop Assemblies but I had to stop because I'm not suppose to use any Interop Assemblies in my Application. Sorry if it didn't help much. Quote Amir Syafrudin
suki_ash Posted February 23, 2007 Author Posted February 23, 2007 Thanks for the reply. Can you please suggest me some sources about Interop Assemblies. Thanks, Subhosh. Quote
amir100 Posted February 23, 2007 Posted February 23, 2007 Back then I went straight to MSDN and I didn't have the chance to look around for any other references. Quote Amir Syafrudin
Recommended Posts