I'm trying to make a macro that changes all comment text to left-to-right text. I can do this manually (create comment, change style to automatically update, then apply LTR) but the macro I record doesn't make the change. Indeed, in Word 2003 it doesn't even work while I'm recording the macro.
Here's the code in Word 2003:
It doesn't work in Word 2007 either. The code (below) seems to basically boil down toCode:Selection.Comments.Add Range:=Selection.Range With ActiveDocument.Styles("Comment Text") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Comment Text" End With Selection.LtrPara With ActiveDocument.Styles("Comment Text") .AutomaticallyUpdate = False .BaseStyle = "Normal" .NextParagraphStyle = "Comment Text" End With WordBasic.RejectChangesSelected
Here's 2007's complete code:Code:ActiveDocument.Styles("Comment Text").ParagraphFormat.Alignment = wdAlignParagraphLeft
Any thoughts?Code:Selection.Comments.Add Range:=Selection.Range Selection.LtrPara WordBasic.FormatStyle Name:="Comment Text", NewName:="", BasedOn:="", _ NextStyle:="", Type:=0, FileName:="", Link:="" With ActiveDocument.Styles("Comment Text").Font .Name = "Arial" .Size = 10 .Bold = False .Italic = False .Underline = wdUnderlineNone .UnderlineColor = wdColorAutomatic .StrikeThrough = False .DoubleStrikeThrough = False .Outline = False .Emboss = False .Shadow = False .Hidden = False .SmallCaps = False .AllCaps = False .Color = wdColorAutomatic .Engrave = False .Superscript = False .Subscript = False .Scaling = 100 .Kerning = 0 .Animation = wdAnimationNone End With With ActiveDocument.Styles("Comment Text").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0) .SpaceBefore = 0 .SpaceBeforeAuto = False .SpaceAfter = 10 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = True .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = True .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 .MirrorIndents = False .TextboxTightWrap = wdTightNone End With ActiveDocument.Styles("Comment Text").NoSpaceBetweenParagraphsOfSameStyle _ = False ActiveDocument.Styles("Comment Text").ParagraphFormat.TabStops.ClearAll With ActiveDocument.Styles("Comment Text").ParagraphFormat With .Shading .Texture = wdTextureNone .ForegroundPatternColor = wdColorAutomatic .BackgroundPatternColor = wdColorAutomatic End With .Borders(wdBorderLeft).LineStyle = wdLineStyleNone .Borders(wdBorderRight).LineStyle = wdLineStyleNone .Borders(wdBorderTop).LineStyle = wdLineStyleNone .Borders(wdBorderBottom).LineStyle = wdLineStyleNone With .Borders .DistanceFromTop = 1 .DistanceFromLeft = 4 .DistanceFromBottom = 1 .DistanceFromRight = 4 .Shadow = False End With End With ActiveDocument.Styles("Comment Text").LanguageID = wdEnglishUS ActiveDocument.Styles("Comment Text").NoProofing = False ActiveDocument.Styles("Comment Text").Frame.Delete


Reply With Quote


