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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
Private Sub Command40_Click()
'Creer une application Word
Dim oWord As Word.Application
Set oWord = CreateObject("Word.Application")
' creer un nouveau document
Dim oDoc As Word.Document
Set oDoc = oWord.Documents.Add()
oWord.Visible = True
Dim RsEnt, qry, qry1, Projet As Recordset
Dim i, k As Integer
'Ici j'essais de créer la bonne variable........................................
'Dim Photoe As AccessObject
'Est-ce qu'il faut que je set la variable à quelque chose?.......................................
'set photoe =
Set qry1 = CurrentDb.OpenRecordset("select count(*) from buffer")
If Not IsNull(qry1.Fields(0).Value) Then
k = qry1.Fields(0).Value
Else
k = 0
End If
Set Projet = CurrentDb.OpenRecordset("select * from soumis_imprim
where no_soumis = " & Combo41 & "")
Set qry = CurrentDb.OpenRecordset("select * from cotation where
id_type_projet = " & Projet("type_proj") & "")
Set qry1 = CurrentDb.OpenRecordset("select * from buffer")
Set RsEnt = CurrentDb.OpenRecordset("select * from cie where id_entete
= " & 0 & "")
Dim oTable As Word.Table
Set oTable = oDoc.Tables.Add(oDoc.Bookmarks.Item("\endofdoc").Range, 10, 1)
'Ici, j'essais de mettre l'image dans la variable................................
'Photoe = RsEnt("imagess")
.................................................................................................
'ici ça marche.........................................................................
'oTable.Rows(1).Range.InlineShapes.AddPicture FileName:="C:\Documents
and Settings\..._logo.jpg", LinkToFile:=False,
SaveWithDocument:=True
........................................................................................
oTable.Rows(1).Range.InsertFile = RsEnt("imagess")
oTable.Rows(2).Range.Text = "Titre"
oTable.Rows(3).Range.Text = "Titre"
oTable.Rows(4).Range.Text = qry("note1").Value & Chr(11) &
qry("note2").Value & Chr(11) & qry("note3").Value & Chr(11) &
qry("note4").Value
Dim c As Integer
c = 5
For i = 1 To k
oTable.Rows(c).Range.Text = qry1.Fields(2).Value & " " &
qry1.Fields(3).Value
c = c + 1
qry1.MoveNext
Next i
oTable.Rows(10).Range.Text = qry("note5").Value & Chr(11) & qry("note6").Value
End Sub |
Partager