Skip to content

Instantly share code, notes, and snippets.

@joleuger
Created September 30, 2017 14:52
Show Gist options
  • Save joleuger/513b79a5fcc1bdf5af5e6ca2b136c9a4 to your computer and use it in GitHub Desktop.
Save joleuger/513b79a5fcc1bdf5af5e6ca2b136c9a4 to your computer and use it in GitHub Desktop.
Word Marko, mit dem in einer Schulaufgabe/Schularbeit zwischen Angabe und Lösung gewechselt werden kann. Dazu muss die Lösung markiert werden, indem sie entweder unterstrichen wird, oder sie von der Formatvorlage "Lösung (versteckt)" bzw. "Lösung (angezeigt)" erbt
Sub Angabe()
'
' Angabe Macro
'
'
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Underline = wdUnderlineDotted
.Replacement.ClearFormatting
.Replacement.Font.Color = wdColorWhite
.Replacement.Font.UnderlineColor = wdColorBlack
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
'
With ActiveDocument.Content.Find
.ClearFormatting
.Style = ActiveDocument.Styles("Lösung (angezeigt)")
.Replacement.ClearFormatting
.Replacement.Style = ActiveDocument.Styles( _
"Lösung (versteckt)")
.Execute Replace:=wdReplaceAll
End With
End Sub
Sub Lösung()
'
' Lösung Macro
'
'
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Underline = wdUnderlineDotted
.Replacement.ClearFormatting
.Replacement.Font.Color = wdColorBlack
.Replacement.Font.UnderlineColor = wdColorBlack
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
'
With ActiveDocument.Content.Find
.ClearFormatting
.Style = ActiveDocument.Styles("Lösung (versteckt)")
.Replacement.ClearFormatting
.Replacement.Style = ActiveDocument.Styles( _
"Lösung (angezeigt)")
.Execute Replace:=wdReplaceAll
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment