Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Changing background color in multiple files?
I want to change the background color in hundreds of .doc files. To do so
one at a time would take hours. Is there any way of doing this for all the files at once? |
#2
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Changing background color in multiple files?
You could modify the method in the article "Find & ReplaceAll on a batch of
documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. "MICROSOFT" wrote in message news I want to change the background color in hundreds of .doc files. To do so one at a time would take hours. Is there any way of doing this for all the files at once? |
#3
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Changing background color in multiple files?
The burning question is 'why'? If you need to print coloured backgrounds the
best answer is to print on coloured paper. Most printer drivers will not allow you to print to the edge of the paper (and if they did the consumption of ink would be astronomical) and so you will get a white edge all the way around the document. If insist in this folly, then the following macro will do the trick for all the documents in a folder (provided they are not protected). Change the RGB colour index RGB(102, 204, 255) for the actual background colour index you want to use. http://www.gmayor.com/installing_macro.htm Sub BatchProcess() Dim strFilename As String Dim strPath As String Dim oDoc As Document Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , _ "List Folder Contents" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" _ Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If If Left(strPath, 1) = Chr(34) Then strPath = Mid(strPath, 2, Len(strPath) - 2) End If strFilename = Dir$(strPath & "*.doc") While Len(strFilename) 0 Set oDoc = Documents.Open(strPath & strFilename) ' 'Do what you want with oDoc ' oDoc.Background.Fill.ForeColor = RGB(102, 204, 255) oDoc.Background.Fill.Visible = msoTrue oDoc.Background.Fill.Solid oDoc.Close SaveChanges:=wdSaveChanges strFilename = Dir$() Wend End Sub "MICROSOFT" wrote in message news I want to change the background color in hundreds of .doc files. To do so one at a time would take hours. Is there any way of doing this for all the files at once? |
#4
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Changing background color in multiple files?
This is 2010. The need for printing is very low. Its almost always for
people living in the last century. But the main reason is its so much easier on the eyes reading black text on a darker background. I find gray is nice but any darker color is nice. The burning question is 'why'? If you need to print coloured backgrounds the best answer is to print on coloured paper. Most printer drivers will not allow you to print to the edge of the paper (and if they did the consumption of ink would be astronomical) and so you will get a white edge all the way around the document. If insist in this folly, then the following macro will do the trick for all the documents in a folder (provided they are not protected). Change the RGB colour index RGB(102, 204, 255) for the actual background colour index you want to use. http://www.gmayor.com/installing_macro.htm Sub BatchProcess() Dim strFilename As String Dim strPath As String Dim oDoc As Document Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , _ "List Folder Contents" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" _ Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If If Left(strPath, 1) = Chr(34) Then strPath = Mid(strPath, 2, Len(strPath) - 2) End If strFilename = Dir$(strPath & "*.doc") While Len(strFilename) 0 Set oDoc = Documents.Open(strPath & strFilename) ' 'Do what you want with oDoc ' oDoc.Background.Fill.ForeColor = RGB(102, 204, 255) oDoc.Background.Fill.Visible = msoTrue oDoc.Background.Fill.Solid oDoc.Close SaveChanges:=wdSaveChanges strFilename = Dir$() Wend End Sub "MICROSOFT" wrote in message news I want to change the background color in hundreds of .doc files. To do so one at a time would take hours. Is there any way of doing this for all the files at once? |
#5
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Changing background color in multiple files?
You could modify the method in the article "Find & ReplaceAll on a batch
of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm The whole website isn't working now but I'll try later. |
#6
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Changing background color in multiple files?
You could modify the method in the article "Find & ReplaceAll on a
batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm The whole website isn't working now but I'll try later. OK - working now. I'm very unversed in VBA stuff. Sort of like looking at Greek for me. Is there any other way of doing a batch background color change? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing background color | Microsoft Word Help | |||
Changing background color | Page Layout | |||
changing msword file icon, to come up as "RED" COLOR BACKGROUND for certain files???? | Microsoft Word Help | |||
Changing background color | Microsoft Word Help | |||
Changing background color | New Users |