Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
MICROSOFT MICROSOFT is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.pagelayout
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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   Report Post  
Posted to microsoft.public.word.pagelayout
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.pagelayout
MICROSOFT MICROSOFT is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.pagelayout
MICROSOFT MICROSOFT is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.pagelayout
MICROSOFT MICROSOFT is offline
external usenet poster
 
Posts: 4
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing background color Granpoh Microsoft Word Help 4 June 10th 09 09:15 AM
Changing background color Twinstar Page Layout 2 November 10th 08 10:11 PM
changing msword file icon, to come up as "RED" COLOR BACKGROUND for certain files???? j00cy Microsoft Word Help 3 January 23rd 08 03:10 AM
Changing background color TopSchmo Microsoft Word Help 3 August 3rd 06 05:03 PM
Changing background color cate New Users 1 May 3rd 06 10:26 PM


All times are GMT +1. The time now is 05:54 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"