Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I remove English (US) as a default language? | Microsoft Word Help | |||
Reading Layout View | Microsoft Word Help | |||
language settings in tables inconsistent? | Microsoft Word Help | |||
Macro name different in Organizer | Microsoft Word Help | |||
How do I remove US english from the spell check? | Microsoft Word Help |