AlexFeddes
Programmer
I want to distribute a template (*.dot file) to enable people to automate certain tasks of marking selected text and copying that to an overview in the document.
I have written certain code to color and add a symbol to selected text, then automatically placing this selected text in a section of the document with a category called "Hightlight (**)" - thereby trying to gather and categorise notes that I glean from text.
I have received some feedback that people already use colorcoding and would like to use their own colors and categories instead of the ones I've defined - is there a way to use a setup document / file with definitions which colors and categories to use
A sample of the code for one categorie is as follows:
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.Font.ColorIndex = wdAuto
With Selection.Font
.Bold = True
End With
Dim Msg, Style, Title, Response, MyString
Msg = "Wilt u de geselecteerde text markeren EN kopiëren naar de sectie 'Studie overzicht'? Klik 'No' als u alleen de geselecteerde text wilt markeren."
Style = vbYesNo + vbDefaultButton1
Title = "Kopieer HIGHLIGHT naar Studie overzicht" '> Replace Word
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Selection.Copy
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Highlight (**)" '> Replace Word
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveUp Unit:=wdLine, Count:=1
' Selection.TypeText Text:=Chr(11) & Chr(11)
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.PasteAndFormat (wdPasteDefault)
Else
Selection.MoveLeft Unit:=wdCharacter, Count:=1
'> Replace sectie
Selection.InsertSymbol Font:="Wingdings", CharacterNumber:=-4030, Unicode _
:=True
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Superscript = True
Selection.Font.Bold = True
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.Font.ColorIndex = wdAuto
Selection.MoveRight Unit:=wdCharacter, Count:=1
End If
The sections I want to refer to in an setup file are:
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.Font.ColorIndex = wdAuto
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Highlight (**)"
Hope you understand my question.
Regards,
Alex
I have written certain code to color and add a symbol to selected text, then automatically placing this selected text in a section of the document with a category called "Hightlight (**)" - thereby trying to gather and categorise notes that I glean from text.
I have received some feedback that people already use colorcoding and would like to use their own colors and categories instead of the ones I've defined - is there a way to use a setup document / file with definitions which colors and categories to use
A sample of the code for one categorie is as follows:
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.Font.ColorIndex = wdAuto
With Selection.Font
.Bold = True
End With
Dim Msg, Style, Title, Response, MyString
Msg = "Wilt u de geselecteerde text markeren EN kopiëren naar de sectie 'Studie overzicht'? Klik 'No' als u alleen de geselecteerde text wilt markeren."
Style = vbYesNo + vbDefaultButton1
Title = "Kopieer HIGHLIGHT naar Studie overzicht" '> Replace Word
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Selection.Copy
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Highlight (**)" '> Replace Word
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveUp Unit:=wdLine, Count:=1
' Selection.TypeText Text:=Chr(11) & Chr(11)
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.PasteAndFormat (wdPasteDefault)
Else
Selection.MoveLeft Unit:=wdCharacter, Count:=1
'> Replace sectie
Selection.InsertSymbol Font:="Wingdings", CharacterNumber:=-4030, Unicode _
:=True
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Superscript = True
Selection.Font.Bold = True
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.Font.ColorIndex = wdAuto
Selection.MoveRight Unit:=wdCharacter, Count:=1
End If
The sections I want to refer to in an setup file are:
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorYellow
Selection.Font.ColorIndex = wdAuto
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Highlight (**)"
Hope you understand my question.
Regards,
Alex