RichtextBox sous Access 2000

dakar2003 Messages postés 3 Date d'inscription vendredi 11 novembre 2005 Statut Membre Dernière intervention 21 août 2008 - 20 août 2006 à 17:59
mortalino Messages postés 6786 Date d'inscription vendredi 16 décembre 2005 Statut Membre Dernière intervention 21 décembre 2011 - 21 août 2006 à 04:50
Bonjour,


Je suis en cours de réaliser sous access 2000, un formulaire ayant le contrôle RictextBox, je bloque sur l'impression du contenu, j'ai trouver sur le site Microsoft "Comment configuere le contrôle RichtextBox pour l'impression", l'ordre Printer. ne fonctionnne pas avec access 2000, par quoi doit on le remplacer ou quelle est la méthode pour imprimer un RichTextBox.

Merci de votre aide.

2 réponses

mortalino Messages postés 6786 Date d'inscription vendredi 16 décembre 2005 Statut Membre Dernière intervention 21 décembre 2011 18
21 août 2006 à 02:48
Salut,

essai ceci (pas testé en access) :

<small> Coloration syntaxique automatique </small>
'*** dans les déclarations :

Private Const CCHDEVICENAME As Long =  32& 
Private Const CCHFORMNAME As Long = 32& 
Private Const PD_RETURNDC As Long = &H100 
Private Const PD_RETURNIC As Long = &H200 
Private Const NULL_PTR As Long = 0& 

Private Type DEVMODE 
    dmDeviceName As String * CCHDEVICENAME 
    dmSpecVersion As Integer 
    dmDriverVersion As Integer 
    dmSize As Integer 
    dmDriverExtra As Integer 
    dmFields As Long 
    dmOrientation As Integer 
    dmPaperSize As Integer 
    dmPaperLength As Integer 
    dmPaperWidth As Integer 
    dmScale As Integer 
    dmCopies As Integer 
    dmDefaultSource As Integer 
    dmPrintQuality As Integer 
    dmColor As Integer 
    dmDuplex As Integer 
    dmYResolution As Integer 
    dmTTOption As Integer 
    dmCollate As Integer 
    dmFormName As String * CCHFORMNAME 
    dmUnusedPadding As Integer 
    dmBitsPerPel As Long 
    dmPelsWidth As Long 
    dmPelsHeight As Long 
    dmDisplayFlags As Long 
    dmDisplayFrequency As Long 
End Type 

Private Type DEVNAMES 
    wDriverOffset As Integer 
    wDeviceOffset As Integer 
    wOutputOffset As Integer 
    wDefault As Integer 
End Type 

Private Type InformationImprimante 
    lStructSize As Long 
    hwndOwner As Long 
    hDevMode As Long 
    hDevNames As Long 
    hdc As Long 
    flags As Long 
    nFromPage As Integer 
    nToPage As Integer 
    nMinPage As Integer 
    nMaxPage As Integer 
    nCopies As Integer 
    hInstance As Long 
    lCustData As Long 
    lpfnPrintHook As Long 
    lpfnSetupHook As Long 
    lpPrintTemplateName As String 
    lpSetupTemplateName As String 
    hPrintTemplate As Long 
    hSetupTemplate As Long 
End Type 

Private Declare Function GlobalLock Lib "kernel32" ByVal hMem As Long) As Long 
Private Declare Function GlobalUnlock Lib "kernel32" ByVal hMem As Long) As Long 

<hr size="2" width="100%" />Sub Impression() 
    Dim imprimanteSelectionne As InformationImprimante 
    Dim infoDevice As DEVMODE 
    Dim adresseStructureDEVMODE As Long 
    Dim imprimante As Printer 

On Error GoTo Saut 
With imprimanteSelectionne 
    .lStructSize =  Len (imprimanteSelectionne) 
    .hDevMode  = NULL_PTR 
    .hDevNames = NULL_PTR 
    .flags = PD_RETURNIC 
End With 


adresseStructureDEVMODE = GlobalLock(imprimanteSelectionne.hDevMode) 


Printer.FontName = "Courier" 
Printer.FontSize = 10 


Printer.Print "Tes données" 


Printer.EndDoc 
adresseStructureDEVMODE = GlobalUnlock(imprimanteSelectionne.hDevMode) 

Exit Sub 


Saut: 
Printer.KillDoc 

End Sub 

<small> Coloration syntaxique automatique </small>

@++

<hr size="2" width="100%" />
  --Mortalino--
Le mystérieux chevalier, "Provençal, le Gaulois"
<!--
0
mortalino Messages postés 6786 Date d'inscription vendredi 16 décembre 2005 Statut Membre Dernière intervention 21 décembre 2011 18
21 août 2006 à 04:50
Re,

bah laisse tomber^^
cela ne fonctionne pas sous Access, désolé !

Bon courage !

@++

<hr size="2" width="100%" />
  --Mortalino--
Le mystérieux chevalier, "Provençal, le Gaulois"
<!--
0
Rejoignez-nous