I recently changed a mail merge application to use late binding to overcome Office version problems.
I open a form to allow the user to select a Word Template and select data. When unloading the form, I used the following to close the document(s) and template without saving them:
If fIsAppRunning("Word") Then
If Not objWord.Documents Is Nothing Then
objWord.Documents.Close ([wdDoNotSaveChanges])
objWord.Quit [wdDoNotSaveChanges]
End If
End If
This used to work perfectly - closing all forms without saving (and without prompts).
After switching to late binding and removing the Word Reference, I get an error on the Close & Quit statements. It doesn't like the "wdDoNotSaveChanges". If I remove the wdDoNotSaveChanges, I get the prompt to save the document.
The error message is "Run-time error '2465: MyApp can't find the field "|" referred to in your expression."
What syntax should I be using? Any suggestions?
I open a form to allow the user to select a Word Template and select data. When unloading the form, I used the following to close the document(s) and template without saving them:
If fIsAppRunning("Word") Then
If Not objWord.Documents Is Nothing Then
objWord.Documents.Close ([wdDoNotSaveChanges])
objWord.Quit [wdDoNotSaveChanges]
End If
End If
This used to work perfectly - closing all forms without saving (and without prompts).
After switching to late binding and removing the Word Reference, I get an error on the Close & Quit statements. It doesn't like the "wdDoNotSaveChanges". If I remove the wdDoNotSaveChanges, I get the prompt to save the document.
The error message is "Run-time error '2465: MyApp can't find the field "|" referred to in your expression."
What syntax should I be using? Any suggestions?