Bonjour

J'éprouve une difficulté à fermer une application Word lancée depuis Notes.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Sub Click(Source As Button)
	Dim ws As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim Doc As NotesDocument
	Dim object As NotesEmbeddedObject
	Dim WApp As Variant
	Dim BMRange As Variant
	
	Set uidoc = ws.CurrentDocument
	Set Doc = ws.CurrentDocument.Document
	Print ("Lettre " & Doc.ChoixFichierWord(0))
	If Doc.ChoixFichierWord(0) = "Mailing" Then
		Set object = Doc.EmbeddedObjects(1) 
	Else ' Courrier simple
		Set object = Doc.EmbeddedObjects(0) 
	End If
	Set WApp = object.Activate ( True ) 
	If Doc.ChoixFichierWord(0) = "Mailing" Then
		rep% = Messagebox ("Voulez-vous fermer le mailing Word ?",36,"Gestion du Courrier") 
		Do While rep%=7
			Set WApp = object.Activate ( True ) 
			rep% = Messagebox ("Voulez-vous fermer le mailing Word ?",36,"Gestion du Courrier") 
		Loop 
		Set WApp = object.Activate ( True ) 	
		WApp.Save
		Set WApp = Nothing 
		Set object = Nothing
		Exit Sub
	End If
Je ne peux pas utiliser Wapp.Quit pour fermer Word car ici l'application est un "EmbeddedObject". Si j'essaye de l'utiliser j'ai une erreur.

Ce qui fait que lorsqu'on fait WApp.Save le fichier est certe bien sauvé mais on retourne sur Word. je voudrais fermer Word.

Merci de votre éclairage !!!

Cordialement,

Christian