OVH Cloud OVH Cloud

boucle et signet avec automation word

2 réponses
Avatar
brucat
Bonjour à toutes et à tous,

J'ai besoin d'envoyer une requete "Propal" vers un document Word.
J'utilise un formulaire qui choisit mon client et rempli le critére de ma
requete
J'utilise automation avec signet .

J'ai 1 client mais 3 lignes de commandes.

Comment créer un tableau et le remplir.
La boucle ne fonctionne pas et je ne sais comment la mettre en place.

Voici ma ligne de code

Private Sub Fusion_Click()

Dim W_App As Object

Set W_App = CreateObject("Word.Application")
With W_App
.Visible = True
.Documents.Open ("c:\contrat\CS .doc")
.ActiveDocument.SaveAs ("c:\"essai .doc")
W_App.ActiveDocument.Bookmarks("Ste").Select
W_App.Selection.InsertAfter DLookup("Societe", "Propal")
W_App.ActiveDocument.Bookmarks("Adresse").Select
W_App.Selection.InsertAfter DLookup("Adresse", "Propal")
W_App.ActiveDocument.Bookmarks("Contact").Select
W_App.Selection.InsertAfter DLookup("Contact", "Propal")
W_App.ActiveDocument.Bookmarks("Logiciel").Select
W_App.Selection.InsertAfter DLookup("Logiciel", "Propal")

W_App.ActiveDocument.Bookmarks("data1").Select

Do Until DCount("Societe", "Propal")
With W_App.Selection
.TypeText DLookup("Logiciel", "Propal")
.MoveRight wdCell
.TypeText DLookup("Qté","Propal")
.MoveRight wdCell
End With
.MoveNext
Loop

Set W_App = Nothing
End With
End Sub


merci pour votre aide.

2 réponses

Avatar
okolo
Bonjour,

es-tu déjà allé voir ici:
http://mypage.bluewin.ch/w.stucki/Integration.htm#ExporterWord

--
okolo
"brucat" a écrit dans le message de news:
dueqjs$8d7$
Bonjour à toutes et à tous,

J'ai besoin d'envoyer une requete "Propal" vers un document Word.
J'utilise un formulaire qui choisit mon client et rempli le critére de ma
requete
J'utilise automation avec signet .

J'ai 1 client mais 3 lignes de commandes.

Comment créer un tableau et le remplir.
La boucle ne fonctionne pas et je ne sais comment la mettre en place.

Voici ma ligne de code

Private Sub Fusion_Click()

Dim W_App As Object

Set W_App = CreateObject("Word.Application")
With W_App
.Visible = True
.Documents.Open ("c:contratCS .doc")
.ActiveDocument.SaveAs ("c:"essai .doc")
W_App.ActiveDocument.Bookmarks("Ste").Select
W_App.Selection.InsertAfter DLookup("Societe", "Propal")
W_App.ActiveDocument.Bookmarks("Adresse").Select
W_App.Selection.InsertAfter DLookup("Adresse", "Propal")
W_App.ActiveDocument.Bookmarks("Contact").Select
W_App.Selection.InsertAfter DLookup("Contact", "Propal")
W_App.ActiveDocument.Bookmarks("Logiciel").Select
W_App.Selection.InsertAfter DLookup("Logiciel", "Propal")

W_App.ActiveDocument.Bookmarks("data1").Select

Do Until DCount("Societe", "Propal")
With W_App.Selection
.TypeText DLookup("Logiciel", "Propal")
.MoveRight wdCell
.TypeText DLookup("Qté","Propal")
.MoveRight wdCell
End With
.MoveNext
Loop

Set W_App = Nothing
End With
End Sub


merci pour votre aide.
Avatar
brucat
Bonjour,

justement je suis parti de là et après plus rien.......

"okolo" (virerpoint)> a écrit dans le message
de news:
Bonjour,

es-tu déjà allé voir ici:
http://mypage.bluewin.ch/w.stucki/Integration.htm#ExporterWord

--
okolo
"brucat" a écrit dans le message de news:
dueqjs$8d7$
Bonjour à toutes et à tous,

J'ai besoin d'envoyer une requete "Propal" vers un document Word.
J'utilise un formulaire qui choisit mon client et rempli le critére de ma
requete
J'utilise automation avec signet .

J'ai 1 client mais 3 lignes de commandes.

Comment créer un tableau et le remplir.
La boucle ne fonctionne pas et je ne sais comment la mettre en place.

Voici ma ligne de code

Private Sub Fusion_Click()

Dim W_App As Object

Set W_App = CreateObject("Word.Application")
With W_App
.Visible = True
.Documents.Open ("c:contratCS .doc")
.ActiveDocument.SaveAs ("c:"essai .doc")
W_App.ActiveDocument.Bookmarks("Ste").Select
W_App.Selection.InsertAfter DLookup("Societe", "Propal")
W_App.ActiveDocument.Bookmarks("Adresse").Select
W_App.Selection.InsertAfter DLookup("Adresse", "Propal")
W_App.ActiveDocument.Bookmarks("Contact").Select
W_App.Selection.InsertAfter DLookup("Contact", "Propal")
W_App.ActiveDocument.Bookmarks("Logiciel").Select
W_App.Selection.InsertAfter DLookup("Logiciel", "Propal")

W_App.ActiveDocument.Bookmarks("data1").Select

Do Until DCount("Societe", "Propal")
With W_App.Selection
.TypeText DLookup("Logiciel", "Propal")
.MoveRight wdCell
.TypeText DLookup("Qté","Propal")
.MoveRight wdCell
End With
.MoveNext
Loop

Set W_App = Nothing
End With
End Sub


merci pour votre aide.