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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word manipulation from vba

Status
Not open for further replies.

h2mhd

Programmer
Feb 20, 2008
40
CA
Hi

i want to create a word document with text images and some formatting, heres what i did:

Dim rs01 As Recordset
Dim db As Database
Dim Strfile As String
Dim stSQL01 As String
Dim strpath As String
strpath = CurrentProject.Path
Dim wApp As Word.Application
Set wApp = New Word.Application

wApp.Visible = True

wApp.Documents.Open strChemin & "\text-test.doc"
stSQL01 = "SELECT Soumission.IDSoumission, Soumission.NuméroSoumissionCombine, Soumission.DateSoumission, Client.Nom, Soumission.AdresseCompleteSoumission, Employe.Employe, Soumission.SoumissonAttDe, Soumission.ObjetSoumission, Soumission.TexteSoumission, Soumission.SalutationSoumission, Soumission.TexteApresDetail FROM (Soumission INNER JOIN Client ON Soumission.IdClient = Client.IDClients) INNER JOIN Employe ON Soumission.IdEmpSoumission = Employe.IDEmploye where idsoumission =" & idctrt

Set db = CurrentDb
Set rs01 = db.OpenRecordset(stSQL01)

With wApp.Selection
.Font.Name = "Times New Roman"
.Font.Size = 12
.TypeParagraph 'ajoute une ligne en Word
.InlineShapes.AddPicture (strChemin & "\logogimatech.jpg")
.BoldRun
.TypeText " Soumision : " & rs01.Fields("numérosoumissioncombine") 'insertion de donnée de type texte
.BoldRun
.TypeParagraph
.BoldRun
.TypeText " Date : "
.BoldRun
.TypeText rs01.Fields("datesoumission")
.TypeParagraph
.TypeParagraph
.Font.Size = 14
.BoldRun
.TypeText rs01.Fields("Nom")
.BoldRun
.TypeParagraph
.TypeText rs01.Fields("adressecompletesoumission")
.TypeParagraph
.TypeParagraph
.Font.Underline = wdUnderlineSingle
.TypeText "Att : "
.TypeText rs01.Fields("SoumissonAttDe")
.Font.Underline = wdUnderlineNone
.TypeParagraph
.TypeParagraph
.BoldRun
.TypeText "Objet : "
.BoldRun
.TypeText rs01.Fields("objetsoumission")
.TypeParagraph
.TypeParagraph
.TypeText rs01.Fields("textesoumission")
.TypeParagraph
.TypeParagraph
.TypeText rs01.Fields("texteapresdetail")
.TypeParagraph
.TypeParagraph
.TypeText rs01.Fields("salutationsoumission")
.TypeParagraph
.TypeParagraph
.TypeParagraph
.ParagraphFormat.Alignment = wdAlignParagraphRight
.TypeText rs01.Fields("Employe")
.TypeParagraph
.TypeText "Gimatech Électrique Inc."
End With


StrNomFichierSauvegarde = rs01!NuméroSoumissionCombine
wApp.ActiveDocument.SaveAs strChemin & "\" & StrNomFichierSauvegarde & ".doc"

Set rs01 = Nothing
Set db = Nothing

so what i want to do is to insert a table with 2 colums and 1 row, the first colums with have an image (.InlineShapes.AddPicture (strChemin & "\logogimatech.jpg")) on it and the second row will have text (idsoumission, date).

Can someone help me to insert this table on my word document?

thanks a lot for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top