Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2018, 01:36 AM
staicumihai staicumihai is offline Macro to set brightness and Contrast in Word 2007 Windows 7 32bit Macro to set brightness and Contrast in Word 2007 Office 2010 32bit
Advanced Beginner
Macro to set brightness and Contrast in Word 2007
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 08-24-2018, 06:07 AM
kilroy kilroy is offline Macro to set brightness and Contrast in Word 2007 Windows 10 Macro to set brightness and Contrast in Word 2007 Office 2016
Competent Performer
 
Join Date: Sep 2016
Location: Southern Ontario
Posts: 118
kilroy is on a distinguished road
Default

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
Reply With Quote
  #3  
Old 08-24-2018, 04:41 PM
macropod's Avatar
macropod macropod is offline Macro to set brightness and Contrast in Word 2007 Windows 7 64bit Macro to set brightness and Contrast in Word 2007 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #4  
Old 08-28-2018, 04:40 AM
staicumihai staicumihai is offline Macro to set brightness and Contrast in Word 2007 Windows 7 32bit Macro to set brightness and Contrast in Word 2007 Office 2010 32bit
Advanced Beginner
Macro to set brightness and Contrast in Word 2007
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default

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
Reply With Quote
  #5  
Old 08-28-2018, 04:41 AM
staicumihai staicumihai is offline Macro to set brightness and Contrast in Word 2007 Windows 7 32bit Macro to set brightness and Contrast in Word 2007 Office 2010 32bit
Advanced Beginner
Macro to set brightness and Contrast in Word 2007
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default

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.
Reply With Quote
  #6  
Old 08-28-2018, 04:44 AM
macropod's Avatar
macropod macropod is offline Macro to set brightness and Contrast in Word 2007 Windows 7 64bit Macro to set brightness and Contrast in Word 2007 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
Quote:
Originally Posted by staicumihai View Post
Do you know how ta make a macro that increases the brightness of a picture with 2 procent ?
The macro in the link I supplied in post #3 shows how to do that.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


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
Macro to set brightness and Contrast in Word 2007 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft