Option Explicit Private Sub Document_Open() Dim response As Integer response = MsgBox("האם אתה מעוניין לגשת ישירות אל העוגן?", vbYesNo, "האם להפעיל את המאקרו?") If response = vbYes Then Call שלי_חיפוש_עוגן End If response = MsgBox("האם אתה מעוניין להסיר את העוגן?", vbYesNo, "האם להפעיל את המאקרו?") If response = vbYes Then Call שלי_הסרת_עוגן End If Exit Sub End Sub Private Sub Document_Close() Dim response As Integer response = MsgBox("האם אתה מעוניין לנעוץ עוגן במקום שבו סיימת לעבוד?", vbYesNo, "האם להפעיל את המאקרו?") If response = vbYes Then Call שלי_נעיצת_עוגן End If Exit Sub End Sub Private Sub שלי_חיפוש_עוגן() ' ' שלי_חיפוש_עוגן Macro ' ' Selection.Find.Execute With Selection.Find .Text = "עוגן נעוץ" .Forward = True End With Selection.Find.Execute Selection.MoveLeft Unit:=wdCharacter, Count:=1 End Sub Private Sub שלי_נעיצת_עוגן() ' ' שלי_נעיצת_עוגן Macro ' ' Selection.TypeParagraph Selection.TypeParagraph Selection.TypeParagraph Selection.MoveUp Unit:=wdParagraph, Count:=1 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter With Selection.Font .Underline = wdUnderlineDouble .UnderlineColor = wdColorAutomatic .Color = wdColorRed .Scaling = 100 .NameBi = "David" .BoldBi = True .Ligatures = wdLigaturesNone .NumberSpacing = wdNumberSpacingDefault .NumberForm = wdNumberFormDefault .StylisticSet = wdStylisticSetDefault .ContextualAlternates = 0 End With Options.DefaultHighlightColorIndex = wdYellow Selection.TypeText Text:="עוגן נעוץ" Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend Selection.MoveUp Unit:=wdParagraph, Count:=1, Extend:=wdExtend Options.DefaultHighlightColorIndex = wdYellow Selection.Range.HighlightColorIndex = wdYellow End Sub Private Sub שלי_הסרת_עוגן() ' ' שלי_הסרת_עוגן Macro ' ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^13^13עוגן נעוץ^13" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue End With Selection.Find.Execute With Selection If .Find.Forward = True Then .Collapse Direction:=wdCollapseStart Else .Collapse Direction:=wdCollapseEnd End If .Find.Execute Replace:=wdReplaceOne If .Find.Forward = True Then .Collapse Direction:=wdCollapseEnd Else .Collapse Direction:=wdCollapseStart End If .Find.Execute End With Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify End Sub