#1
|
|||
|
|||
Macro to set brightness and Contrast in Word 2007
Hi guys,
I need a macro that sets the brightness of a picture at -75% and the contrast at 98% I use Microsoft Word 2007 Do you have any ideas? Thanks a lot. |
#2
|
|||
|
|||
Not sure about 2007 but I only have 2016. This changes all pictures in a document. Not sure how to modify to cycle through or select one picture.
Code:
Sub ChangeBrightnessAndContrastAllPictures() 'Kilroy Dim objPic As InlineShape For Each objPic In ActiveDocument.InlineShapes objPic.PictureFormat.Brightness = 0.25 objPic.PictureFormat.Contrast = 0.98 Next objPic End Sub |
#3
|
||||
|
||||
Pictures can be either in-line or wrapped; Kilroy's macro processes only inline pictures. For a macro that shows how to deal with both, see: https://www.msofficeforums.com/drawi...tml#post130625
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Thanks Kilroy, I modified the macro you gave me:
Code:
Option Explicit Sub Brightness() Dim objPic As InlineShape Dim iShp As InlineShape Dim ShpScale As Double With Selection For Each objPic In .InlineShapes With objPic If .Type = wdInlineShapePicture Or wdInlineShapeLinkedPicture Then objPic.PictureFormat.Brightness = 0.25 objPic.PictureFormat.Contrast = 0.98 End If End With Next objPic End With End Sub |
#5
|
|||
|
|||
Macropod, thanks for your reply,
Do you know how ta make a macro that increases the brightness of a picture with 2 procent ? I want to be able to fine adjust the brightness and contrast. |
#6
|
||||
|
||||
Your code is way over-done and, other than the 'type test', adds no functionality to what kilroy supplied! Indeed, it could even be reduced to:
Code:
Sub Brightness() Dim iShp As InlineShape For Each iShp In Selection.InlineShapes With iShp If .Type = wdInlineShapePicture Or wdInlineShapeLinkedPicture Then .PictureFormat.Brightness = 0.25 .PictureFormat.Contrast = 0.98 End If End With Next End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Font color in high contrast mode | jineu21 | Word | 4 | 03-05-2021 05:24 AM |
Convert Word 2007 macro to work in Word 2003 | Kamaflage | Word VBA | 1 | 02-25-2015 11:40 PM |
Splitter Macro for Word 2007 | donny12 | Word VBA | 1 | 09-29-2013 09:00 PM |
Please help with a macro in Microsoft Word 2007 | AKMMS | Word VBA | 0 | 06-23-2010 02:16 PM |
Word 2003 macro to Word 2007 to 2010 to... | maruapo | Word VBA | 0 | 06-04-2010 03:43 PM |