0 votes
by (750 points)

objMailContent.Save(strTempPath + GroupID + "\" + StrDocFileName);

var wordApp = new Microsoft.Office.Interop.Word.Application(); var wordDocument = wordApp.Documents.Open(strTempPath + GroupID + "\" + StrDocFileName);

wordDocument.ExportAsFixedFormat(strAttachmentPath + StrNewFileName, Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF);
wordDocument.Close(Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNoteChanges, Microsoft.Office.Interop.Word.WdOriginalFormat.wdOriginalDocumentFormat, false); //Close document
wordApp.Quit(); //Important: When you forget this Word keeps running in the background
bIsDocFile = true;

The above is the code for converting a .doc or .docx document to pdf and saves it on to my drive normally.
The above code is a part of my application which uses REBEX.

The above code works fine when I try to run my application through scheduler when i select an option "Run only when User is logged on" when i select option "Run whether user is logged on or not" the above code gives an error of "Object not set to reference".

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (58.9k points)

What is the full stack trace of the error message that you get?

try
{
    //... your code
}
catch(Exception ex)
{
    Console.WriteLine(ex.ToString());
}
asked Apr 10, 2015 by (750 points)
edited Apr 10, 2015 by
Stack trace to above query
...