Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Nou pe simpatie: simpacurly69 la Simpatie.ro
 | Femeie 24 ani Bucuresti cauta Barbat 35 - 70 ani |
|
|
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
|
| #1 |
TRaPModerator
Postari: 960
|
|
Source: https://wordribbon.tips.net/T005227_Cha ... _Text.html
Sub DocumentChangeLanguage2()
Dim r As Range Dim p As Paragraph
For Each r In ActiveDocument.StoryRanges For Each p In r.Paragraphs p.Range.LanguageID = wdRomanian Next p Next r End Sub |
The code doesn't do it for Text Frames or Shapes, but the code in the next post will.
|
|
| |
|
| #2 |
TRaPModerator
Postari: 960
|
|
Source: https://cybertext.wordpress.com/2011/10 ... ost-eleme/
Sub DocumentChangeLanguage2All()
Application.ScreenUpdating = False
Dim rngStory As word.Range Dim lngJunk As Long Dim oShp As Shape lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader Selection.EscapeKey
For Each rngStory In ActiveDocument.StoryRanges 'Iterate through all linked stories Do On Error Resume Next rngStory.LanguageID = wdRomanian Select Case rngStory.StoryType Case 6, 7, 8, 9, 10, 11 '1, 2, 3, 4, 5, 12, 13, 14, 15, 16, 17 ' more about StoryTypes: https://docs.microsoft.com/en-us/office/vba/api/word.wdstorytype If rngStory.ShapeRange.Count > 0 Then For Each oShp In rngStory.ShapeRange If oShp.TextFrame.HasText Then oShp.TextFrame.TextRange.LanguageID = wdEnglishAUS End If Next End If Case Else 'Do Nothing End Select On Error GoTo 0 'Get next linked story (if any) Set rngStory = rngStory.NextStoryRange Loop Until rngStory Is Nothing Next
Application.ScreenUpdating = True
End Sub
|
|
|
| |
|
| #3 |
|
|
This line in the post above: lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType inserted a paragraph in the header of the document - when the document didn't have a header - moving all text down with 1 line (the code created a header made of an empty paragraph).
To fix that, I edited the post above and added in color 2 new lines - they open header then exit it, which is enough to make the empty paragraph "back off".
Also added Application.ScreenUpdating lines to prevent screen flickering while the code does its thing.
_______________________________________

|
|
| |
|