Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
75coupe 75coupe is offline
external usenet poster
 
Posts: 2
Default Macro for changing language settings for exsisting docs

I have a server with over 220,000 documents (not to mention our other 8
sites). Over the years be fore I started here all computers were setup with
US dictionaries (I'm in Australia). So I want to change all documents to
Australian language so they will be spell checked using Aust. Dictionaries.

So I need a macro that will go through my whole server, open and change the
language settings on the whole document then save and close and move onto the
next doc...

Does this exsist..? Can Microsoft supply this? Can someone write this?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Macro for changing language settings for exsisting docs

On Thu, 11 Jan 2007 17:02:00 -0800, 75coupe
wrote:

I have a server with over 220,000 documents (not to mention our other 8
sites). Over the years be fore I started here all computers were setup with
US dictionaries (I'm in Australia). So I want to change all documents to
Australian language so they will be spell checked using Aust. Dictionaries.

So I need a macro that will go through my whole server, open and change the
language settings on the whole document then save and close and move onto the
next doc...

Does this exsist..? Can Microsoft supply this? Can someone write this?


The following is a lashup of a few macros from the MVP web site. When
the Browse dialog comes up, choose a folder that contains documents
and/or subfolders that contain documents. I'd very strongly suggest
that you don't try to process all 220,000 documents in one go -- even
if Word doesn't run out of resources, it will tie up your server for a
good many hours. Beware of documents that require a password to open;
I think they might crash the macro.

Public Sub BatchToOz()
' based on http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim Response As Long
Dim i As Long

PathToUse = GetFolder
If Len(PathToUse) = 0 Then Exit Sub

On Error Resume Next

'Set the directory and type of file to batch process
With Application.FileSearch
.NewSearch
.LookIn = PathToUse
.SearchSubFolders = True
.FileName = "*.doc"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles

If .Execute() Then

For i = 1 To .FoundFiles.Count

'Open document
Set myDoc = Documents.Open(.FoundFiles(i))

TreatAllRanges myDoc

'Close the modified document after saving changes
myDoc.Close SaveChanges:=wdSaveChanges
Next i
End If
End With
End Sub

Private Sub TreatAllRanges(thisDoc As Document)
' based on
' http://word.mvps.org/faqs/customizat...ceAnywhere.htm
Dim rngStory As Word.Range
Dim lngJunk As Long

'Fix the skipped blank Header/Footer problem
' as provided by Peter Hewett
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryT ype

'Iterate through all story types in the current document
For Each rngStory In thisDoc.StoryRanges
'Iterate through all linked stories
Do
rngStory.LanguageID = wdEnglishAUS

'Get next linked story (if any)
Set rngStory = rngStory.NextStoryRange
Loop Until rngStory Is Nothing
Next
End Sub


Private Function GetFolder() As String
Dim fd As FileDialog
Dim result As String

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.AllowMultiSelect = False
If .Show = -1 Then
result = .SelectedItems(.SelectedItems.Count) & "\"
End If
End With
Set fd = Nothing
GetFolder = result
End Function

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
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
How do I remove English (US) as a default language? Rigadon Microsoft Word Help 20 November 5th 09 05:58 AM
Reading Layout View Andrea Microsoft Word Help 38 December 26th 06 07:37 AM
language settings in tables inconsistent? jop Microsoft Word Help 5 December 8th 06 05:38 PM
Macro name different in Organizer Tarallen Microsoft Word Help 6 November 13th 06 06:18 PM
How do I remove US english from the spell check? jeamsu Microsoft Word Help 22 November 11th 05 03:55 PM


All times are GMT +1. The time now is 01:21 PM.

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"