I have an app that builds a word document file from a data-set with Merge fields.
Everything worked fine, but the program won’t run on our terminal server.
However, it works fine on my local machine.
I am getting the error "Command failed" on my terminal server. My code runs, but I’m not able to save the document afterwords.
word.AddTemplate(strFQDN, ref objDoc, ref objWord);
word.ParagraphsInList(ref objDoc, ref objWord, ref parags);
word.PrintParagraphsPerRecord(ref objWord, ref objDoc, ref parags, ds, PKref);
word.WordInvullen(ref objDoc, ref objWord, PKref, ds);
All the above with the subcode work. When I come to the saving part I get the command failed.
//objWord.Documents.Save(ref missing, ref missing);
//objWord.Documents.Save(false, true);
//objDoc.Save();
objDoc.SaveAs2("c:\\Template\\offerte 1001", WdSaveFormat.wdFormatDocument, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
Does anyone have a clue why the saving part of the word.interop isn’t working?
Apperently this was the problem:
The save was disabled in the file block settings.