Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Word > VBA Word
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 27/12/2007, 11h39   #1
Invité de passage
 
Inscription : décembre 2007
Messages : 2
Détails du profil
Informations forums :
Inscription : décembre 2007
Messages : 2
Points : 1
Points : 1
Par défaut Macro pb impression Word 2003

Bonjour,
une partie de nos utilisateurs utilisent une macro word qui leur demande sur quelle imprimante ils veulent imprimer (un choix de 2 imprimantes) et ensuite combien ils veulent de papier blanc (bac 1) et de papier en-tete (bac 2).
Cette macro fonctionne pour l'impression mais des lors qu'elle est utilisée apres il est impossible d'imprimer sous excel ou un autre programme il faut quitter Word, fermer et réouvrir la session Windows et ensuite imprimer sous excel ou word et forcement si on relance la macro Word le probleme réapparait.
Je n'ai aucunes connaissance en développement (je suis technicien informatique micro/reseau).

Ci dessous la macro, il y a t'il un problème dans cette macro ou un oubli.

Merci d'avance pour votre aide

Code :
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
Sub A_lancer()
 
 
 
    Dim IMPRIMANTE As String, _
 
        TIROIR_ENTETE As String, _
 
        TIROIR_BLANC As String, _
 
        NBFEUILLES As Integer, _
 
        NBCOPIES As Integer, _
 
        REPONSE As String
 
 
 
    NBFEUILLES = ActiveDocument.BuiltInDocumentProperties("Number of pages")
 
    NBCOPIES = InputBox("Combien d'exemplaires sur papier blanc voulez-vous ?")
 
 
 
 
 
    '-Choix de l'imprimante----------------------------------------------------------------------------------------------
 
    REPONSE = MsgBox("Il y a " & NBFEUILLES & " page(s) dans " & ActiveDocument.Name & Chr(10) & Chr(10) _
 
                    & "Vous voulez imprimer sur la 1855 ?", _
 
                    vbYesNoCancel + vbQuestion, _
 
                    "Validation de l'imprimante")
 
 
 
    If REPONSE = vbNo Then
 
        REPONSE = MsgBox("Vous voulez imprimer sur la T612 ?", vbYesNoCancel + vbQuestion, "Validation de l'imprimante")
 
        If REPONSE = vbYes Then
 
            REPONSE = vbNo
 
            Else: REPONSE = vbCancel
 
            End If
 
        End If
 
 
 
    '-Impression -------------------------------------------------------------------------------------------------------
 
 
 
    Select Case REPONSE
 
        '====================================================================================================================
 
        Case vbYes
 
            IMPRIMANTE = "\\Printa\CIVC Laser NB 1855 - Propriété"
 
            TIROIR_ENTETE = "Tiroir 2"
 
            TIROIR_BLANC = "Tiroir 1"
 
            Call Impression(IMPRIMANTE, TIROIR_ENTETE, TIROIR_BLANC, NBFEUILLES, NBCOPIES)
 
        '====================================================================================================================
 
        Case vbNo
 
            IMPRIMANTE = "\\Printa\CIVC Laser NB T612 - Propriété"
 
            TIROIR_ENTETE = "Tiroir 2"
 
            TIROIR_BLANC = "Tiroir 1"
 
            Call Impression(IMPRIMANTE, TIROIR_ENTETE, TIROIR_BLANC, NBFEUILLES, NBCOPIES)
 
        '====================================================================================================================
 
        Case Else
 
            MsgBox "Vous devez travailler avec la 1855 ou la T612"
 
        '====================================================================================================================
 
        End Select
 
 
 
 
 
End Sub
 
 
 
 
 
Sub Impression(IMPRIMANTE, TIROIR_ENTETE, TIROIR_BLANC, NBFEUILLES, NBCOPIES)
 
 
 
    Dim NUMPAG As String
 
 
 
    ActivePrinter = IMPRIMANTE
 
 
 
    With Options
 
        .UpdateFieldsAtPrint = False
 
        .UpdateLinksAtPrint = False
 
        .PrintBackground = True
 
        .PrintProperties = False
 
        .PrintFieldCodes = False
 
        .PrintComments = False
 
        .PrintHiddenText = False
 
        .PrintDrawingObjects = True
 
        .PrintDraft = False
 
        .PrintReverse = False
 
        .MapPaperSize = True
 
        End With
 
 
 
    With ActiveDocument
 
        .PrintPostScriptOverText = False
 
        .PrintFormsData = False
 
        End With
 
 
 
    '-Impression du document sur papier entete---------------------------------------------------------------------------
 
    Options.DefaultTray = TIROIR_ENTETE
 
 
 
    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
 
        wdPrintDocumentContent, Copies:=1, Pages:="1", PageType:=wdPrintAllPages, _
 
         Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
 
         PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
 
 
 
 
 
    If NBFEUILLES > 1 Then
 
 
 
        Options.DefaultTray = TIROIR_BLANC
 
 
 
        NUMPAG = "2-" & NBFEUILLES
 
 
 
        Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
 
            wdPrintDocumentContent, Copies:=1, Pages:=NUMPAG, PageType:=wdPrintAllPages, _
 
             Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
 
             PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
 
 
 
        End If
 
 
 
    '---Impression des documents sur papier vierge-----------------------------------------------------------------------
 
    If NBCOPIES > 0 Then
 
        Options.DefaultTray = TIROIR_BLANC
 
 
 
        Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
 
            wdPrintDocumentContent, Copies:=NBCOPIES, Pages:="", PageType:=wdPrintAllPages, _
 
            Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
 
            PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
 
        End If
 
 
 
    '--------------------------------------------------------------------------------------------------------------------
 
 
 
End Sub
foliedti est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 16h53.


 
 
 
 
Partenaires

Hébergement Web