Dim Appl As New Application
Dim WithEvents CrSecPH As Section 'dim them with events so we can access the format event
Dim WithEvents CrSecPF As Section 'dim them with events so we can access the format event
Dim CrSecs As Sections
Public Pic1 As OLEObject 'Dim an object for the ole pictures so we can change the pic
Dim Image_Trouvé As Boolean
'
Private Sub CrSecPH_Format(ByVal pFormattingInfo As Object)
On Error GoTo fin
If Chargement_Entete_page = False Then Exit Sub
If Image_Trouvé = True Then
Image1.Picture = LoadPicture(Chemin & Nom_Logo)
Set Pic1.FormattedPicture = LoadPicture(Chemin & Nom_Logo)
Pic1.Width = Image1.Width
Pic1.Height = Image1.Height
End If
Exit Sub
fin:
MsgBox Err.Description
End Sub
'
Private Sub Form_Load()
On Error GoTo fin
Screen.MousePointer = 0
Set CrSecPH = RpT.Sections("PH") ' set this section object to the page header
For i = 1 To CrSecPH.ReportObjects.Count 'Loop through the report objects and see if they are pictures
If CrSecPH.ReportObjects(i).Kind = crOleObject Then ' if it is a CrOleObject then
Set Pic1 = CrSecPH.ReportObjects(i) 'Set the pic1 object to the Ole Report object
Image_Trouvé = True
End If
Next i
Exit Sub
fin:
msgbox err.description
End Sub