I am trying to translate a previously created Word 2007 ribbon set (8 tabs, about 150 buttons and 10 checkboxes) from VB done in VS2005 to C# in VS2010. The issue I'm having is that I'm unable to set the control for the buttons to open a new document using a template with macros enabled. I have a confirmed file path for each template and I've used a VB-C# translator, but for some reason it's not working properly. Here is what I have as my method for loading the template(s) so far:
private void _LoadTemplate(string templateName) { string templatePath1 = "//Macro - Development"; string templatePath2 = "//Macro - Development/Templates No Longer Updated"; if(File.Exists(templatePath1 + templateName)) { Document doc = Application.Documents.Add(Template = templatePath1 + templateName); } else if (File.Exists(templatePath2 + templateName)) { Document doc = Application.Documents.Add(Template = templatePath2 + templateName); } else { MsgBox = "Template does not exist."; }
There are a few main options:
Office 2007 and Office 2010 Word document files are essentially identical, as is the programming model and API changes between them - I think the only difference that matters is that Office 2010's UI looks better than 2007.