![]() |
|
|
|
#1
|
|||
|
|||
|
Hello! I have 96 word documents, each document having between 10 and 40 images, and I need to brighten all of the images by about 25%. Is there a way to do this for each document instead of brightening each image individually? |
|
#2
|
||||
|
||||
|
To brighten every image in every document in a folder by 25%, you could use a macro like:
Code:
Sub UpdateDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document, Shp As Shape, iShp As InlineShape
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
If strFolder & "\" & strFile <> strDocNm Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
For Each Shp In .Shapes
With Shp
Select Case .Type
Case msoPicture, msoLinkedPicture: .PictureFormat.Brightness = .PictureFormat.Brightness * 1.25
End Select
End With
Next
For Each iShp In .InlineShapes
With iShp
Select Case .Type
Case wdInlineShapePicture, wdInlineShapeLinkedPicture: .PictureFormat.Brightness = .PictureFormat.Brightness * 1.25
End Select
End With
Next
.Close SaveChanges:=True
End With
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Thank you! Is there a similar macro that could be used to change them all to Word's "Grayscale" setting?
|
|
#4
|
||||
|
||||
|
Simply change the two instances of:
.PictureFormat.Brightness = .PictureFormat.Brightness * 1.25 to: .PictureFormat.ColorType = msoPictureGrayscale
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
You're a macro god. Thank you for saving me roughly 15 hours of work.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Transfer images from Visio to Word without losing the settings | angelspund88 | Visio | 2 | 05-29-2016 04:34 PM |
Editing restriction for text fields and images
|
expert4knowledge | Word | 5 | 08-21-2012 04:00 AM |
Editing multiple labels
|
nels04 | Word | 2 | 12-06-2011 03:48 AM |
editing of images, tables and caption in the whole document.
|
Jamal NUMAN | Word | 4 | 07-08-2011 04:14 AM |
Editing multiple docs
|
frankdh | Word | 2 | 11-02-2010 10:59 AM |