-2
我试图从VS2005中的VB到VS2010中的C#中将之前创建的Word 2007功能区集(8个选项卡,约150个按钮和10个复选框)进行翻译。 我遇到的问题是,我无法设置按钮的控件以使用启用了宏的模板来打开新文档。我为每个模板都有一个确认的文件路径,而且我使用了VB-C#翻译器,但由于某些原因,它无法正常工作。 这里是我有我的加载模板(一个或多个)方法至今:C#/ VS2010在运行时从模板生成新文档
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."; }