Onetastic
Home
Macroland
Blog
OneCalendar
Pricing
How To
Login
Download
Go to Macroland Home
Color VB Comments
Changes color of text starting with a single quote (') on selected lines to green
Download
Color VB Comments
If this didn't work,
get help
downloading this macro
Author(s)
:
Onetastic ★
Category
:
Formatting
Last Updated
:
October 17, 2016
Requirements
:
OneNote 2010 or above
Changelog
:
October 17, 2016
(E9FA79)
-
Onetastic ★
Initial Version
Comments
Name
E-mail me if someone replies
Comment
Send Feedback
Dan
- 2017-01-25
Hello Omer,
what if I wrapped my word at both ends eg %Hello% would a macro be able to isolate or identify that word using the index of characters?
If string contains characters start position?
Omer Atay
- 2017-01-22
Dan: Macros currently don't have a way to query whole words or otherwise identify word boundaries. Therefore writing this kind of macro that has to deal with words is very hard.
Dan
- 2017-01-22
Hello Omer,
I would like to Change the Font Color of words that have a % in front of them,
I know this is a lot to ask but I would be really grateful, please please can you help me to adapt this so I can color my words.
<?xml version="1.0" encoding="utf-16"?>
<Macro name="Color VB Comments -Omer" category="TEST" description="Changes color of text starting with a single quote (') on selected lines to green" publishDate="00-00-00T00:00:00.000Z" version="15">
<Comment text="----------------------------------------------------------------------------------" />
<Comment text=" Color Words" />
<Comment text="----------------------------------------------------------------------------------" />
<Expression>$color = "#FF0099"</Expression>
<Comment text="Find all the selected paragraphs" />
<ForEach var="p">
<Array>QueryObjects("Text", GetCurrentPage())</Array>
<Comment text="Find quotes as the beginning of a comment" />
<Expression>$quotes = QueryText($p, "%", false)</Expression>
<If>
<Condition>Array_Length($quotes) == 0</Condition>
<Continue>1</Continue>
</If>
<Comment text="Start coloring from the first quote " />
<Expression>$quote = $quotes[0]</Expression>
<Expression>$quote.fontColor = $color</Expression>
<Comment text="Get all the text in the paragraph and color the ones that are after the first quote" />
<ForEach var="text">
<Array>QueryObjects("Text", $p)</Array>
<If>
<Condition>$text.startIndex > $quote.startIndex</Condition>
<Expression>$text.fontColor = $color</Expression>
</If>
</ForEach>
</ForEach>
</Macro>
I have been trying for months and cant make it work :( :(
I have left the original as above as I cant work out how to isolate the words with a % in front of them.
Normally I have to copy and paste to word - and then paste back and I have too many pages to do everyday
When ever you have a chance thank you so much
Related Macros
All Section Font Arial Black, ...
Paragraph Spacing = 20
Indent First Line
Paragraph Spacing = 3
Paragraph Spacing = 9
OneNote转为MD格式
Paragraph Spacing = 0
Paragraph Spacing = 7
Add Space After Paragraphs
Remove All Indents From All Pa...
Clark_Title
Clark_Text
Clark_Code
字体修正
Format Numbers
Highlight Hashtags
Color PowerShell Comments + No...
Color PowerShell Comments
Align and Space
Indent Paragraphs
中英样式
Select Text With Similar Forma...
设置默认格式
Toggle Red/Black
Align Left
See all other macros
Macros by This Author
Insert Monthly Calendar
Sort Pages
TOC in Current Notebook
Search & Replace
TOC in Current Page
Weekly Planner
Insert Horizontal Line
Monthly Calendar With Task Lis...
TOC in Current Section
Resize Images
Sort Sections
Sort Pages by Date
Daily Planner Page
Sort Notebooks
Weekly Planner for each day wi...
Insert Yearly Calendar
Function
Blackboard page
Word Count
Show More