Imprimer en couleur
bonjour,
j'ai une imprimante qui peut imprimer en couleur mais qui par defaut imprime en noir et blanc.
d'autre part, la feuille excel que je cherche a imprimer contient un tableau (avec de nombreuses couleurs) et des commentaires pour certaines cellules.
je cherche a imprimer mon tableau ainsi que les commentaires en couleur.
j'utilise donc le code suivant pour mettre genrer une impression couleur :
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = Feuil3.Name Then ActiveSheet.PageSetup.BlackAndWhite = False
End Sub
le probleme, c'est qu'avec cette methode mon tableau sort en noir et blanc alors que les commentaires sont en couleur (jaune) !!!!
c'est tout bonnement incroyable !
je me dit que c'est peut etre lie au fait que je demande l'impression de la FEUILLE en couleur alors qu'il faudrait agir sur l'IMPRIMANTE (ie. sur un objet du genre "Printer" et non sur "PageSetup").
pourriez-vous m'aider et me dire comment solutionner mon pbl ?
merci a vous !
je pense qu'on s'approche de la reponse. "objItem.Color = 2" si l'imprimante peut imprimer en couleur mais moi j'aimerais la faire imprimer en couleurs si elle est positionnee sur "noir et blanc" (ce qui est le cas par defaut ...).
Sub ProprietesImprimantes()
Dim objWMIService As Object, colItems As Object
Dim objItem As Object
Dim strComputer As String
Dim i As Byte
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.execQuery("Select * from Win32_printerConfiguration", , 48)
For Each objItem In colItems
i = i + 1
Cells(1, i) = "bitsPerPel: " & objItem.bitsPerPel
Cells(2, i) = "Caption: " & objItem.Caption
Cells(3, i) = "Collate: " & objItem.Collate
Cells(4, i) = "Color: " & objItem.Color
Cells(5, i) = "Copies: " & objItem.Copies
Cells(6, i) = "Description: " & objItem.Description
Cells(7, i) = "deviceName: " & objItem.deviceName
Cells(8, i) = "displayFlags: " & objItem.displayFlags
Cells(9, i) = "displayFrequency: " & objItem.displayFrequency
Cells(10, i) = "ditherType: " & objItem.ditherType
Cells(11, i) = "driverVersion: " & objItem.driverVersion
Cells(12, i) = "Duplex: " & objItem.Duplex
Cells(13, i) = "formName: " & objItem.formName
Cells(14, i) = "horizontalResolution: " & objItem.horizontalResolution
Cells(15, i) = "ICMIntent: " & objItem.ICMIntent
Cells(16, i) = "ICMMethod: " & objItem.ICMMethod
Cells(17, i) = "logPixels: " & objItem.logPixels
Cells(18, i) = "mediaType: " & objItem.mediaType
Cells(19, i) = "Name: " & objItem.Name
Cells(20, i) = "Orientation: " & objItem.Orientation
Cells(21, i) = "paperLength: " & objItem.paperLength
Cells(22, i) = "paperSize: " & objItem.PaperSize
Cells(23, i) = "paperWidth: " & objItem.paperWidth
Cells(24, i) = "pelsHeight: " & objItem.pelsHeight
Cells(25, i) = "pelsWidth: " & objItem.pelsWidth
Cells(26, i) = "printQuality: " & objItem.PrintQuality
Cells(27, i) = "Scale: " & objItem.Scale
Cells(28, i) = "SettingID: " & objItem.SettingID
Cells(29, i) = "specificationVersion: " & objItem.specificationVersion
Cells(30, i) = "TTOption: " & objItem.TTOption
Cells(31, i) = "verticalResolution: " & objItem.verticalResolution
Cells(32, i) = "XResolution: " & objItem.Xresolution
Cells(33, i) = "YResolution: " & objItem.Yresolution
Columns(i).AutoFit
Next
End Sub
hello
pour faire une petite macro Windows, j'utilise AutoIt ou AutoHotKey (gratuits)
Assez facile pour modifier un paramètre comme tu le veux.
Mais ton script ne sera valable que pour un modèle d'imprimante. A réécrire pour d'autres modèles.
slt à tous, j'aimerais savoir si c'est possible de trouver un code vba pour l'impression de mon fichier. ce code doit imprimer le fichier en couleur et en noir et blanc. une copie de chaque.merci