使用Word VBA将图片重新着色为黑白的75%

问题描述 投票:0回答:1

我在下面使用Word文档。

Sub Recolor()

Dim pic As InlineShape
Dim shp As Shape

Set pic = Selection.InlineShapes(1)
Set shp = Selection.ShapeRange(1)

pic.PictureFormat.ColorType = msoPictureBlackAndWhite
shp.PictureFormat.ColorType = msoPictureBlackAndWhite

End Sub

执行Black and White 50%

但是我需要Black and White 75%,如何编码75%重新着色?

vba image ms-word
1个回答
1
投票
75%表示XML中称为

Threshold的颜色转换参数。但是阈值在VBA中不可用。这是一个通过降低亮度,增加对比度和降低饱和度来获得相似外观的宏。您可以使用值和命令顺序进行操作,这与最终外观有所不同:

Sub Recolor() Dim pic As InlineShape Set pic = Selection.InlineShapes(1) With pic With .PictureFormat .Brightness = 0.24 .Contrast = 1 End With With .Fill.PictureEffects .Insert(msoEffectSaturation).EffectParameters(1).value = 0 End With End With End Sub
© www.soinside.com 2019 - 2024. All rights reserved.