how to suppress error messages when using process

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
Hi All,

I have a small windows application that gets word documents from a source folder, prints the documents and moves the documents to a destination folder.

The printing is done using the following code:
VB.NET:
            Dim printProcess As New Process
            printProcess.StartInfo.CreateNoWindow = True
            printProcess.StartInfo.Verb = "Print"
            printProcess.StartInfo.FileName = filePath
            printProcess.Start()

This works great when there are no problems with the word documents. Word will open, print the file and close.

But the documents have one problem: the documents are set to A4 paper, with margins set so small word will ask this question: "The margins of section 1 are set outside the printable area of the paper. Do you want to continue?" And the user has to click yes or no.

The reason this application was build is so the documents can be printed without user interaction (there are several thousands of documents), so if the user has to answer this question for each document, it kinda loses it's purpose...

Does anyone have an idea of how to suppress this question? I had hoped that the line
VB.NET:
printProcess.StartInfo.CreateNoWindow = True
would do the trick, but it doesn't make any difference.

Any help would be greatly appreciated.

Thanks,
Rick
 
This would do exactly what I need, only I need to do it from the VB.Net code. It is not possible for me to add the macro to the documents, since they are generated by another (ancient) system.

Thanks,
Rick
 
This would do exactly what I need, only I need to do it from the VB.Net code. It is not possible for me to add the macro to the documents, since they are generated by another (ancient) system.

Thanks,
Rick
you can probably use the code from the Macros if you do not "shell" the Word application for printing, but instead use the Word Interop and do the doc loading and printing from that point.
 
Back
Top