Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Mail Merge Late Binding Problem 1

Status
Not open for further replies.

khood

Programmer
Aug 27, 2000
163
0
0
US
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?
 
When switching to late binding, you cannot use any of the Word constants, you need the value it represents. In the immediate pane (ctrl+g) in Word, type:

[tt]? wdDoNotSaveChanges[/tt]

hit enter and use the number returned in stead.

Roy-Vidar
 
RoyVidar - you're the man!


objWord.Documents.Close 0
objWord.Quit 0


That worked perfectly!

Thanks for your help on this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top