Microsoft Office Tutorials and References
In Depth Information
Highlighting a Selection
' * * * * *¶
Function DoubleBackslashes(s As String) As String¶
'Variable declaration¶
Dim newString As String, startPos As Long, endPos As Long¶
startPos = 1¶
'Locate each backslash and insert an additional one¶
Do While InStr(startPos, s, "\") <> 0¶
endPos = InStr(startPos, s, "\")¶
newString = newString & Mid(s, startPos, endPos - startPos + 1) & "\"¶
startPos = endPos + 1¶
Loop¶
newString = newString & Mid(s, startPos)¶
DoubleBackslashes = newString¶
End Function¶
Wrd
This tool is built modularly so that it can be adapted to various requirements
fairly easily. For example, to do a regular Find and Replace, record a macro for
the search to use, then substitute the recorded code for the code in the
procedure DoFind.
This macro changes the path of linked objects that are formatted in-line with
the text only (no text wrap formatting is applied). To combine this macro with
text wrap, insert the linked object into a FRAME (from the Forms toolbar).
Highlighting a Selection
With this procedure, you can apply highlighting to selected text or highlight an
entire word at the insertion point if there is no selection.
Example file:
W003
Scenario: Highlighting is a very useful functionality, but
selecting text, moving to the toolbar button, then selecting
the color quickly becomes a tedious task. Instead, it would
be useful to simply hit a keyboard combination in order to
apply highlighting; and, if no text is selected, to automatically
apply it to the word in which the insertion point is currently
blinking.
View the Appendix to learn how to store this procedure
in a Standard module.
 
Search JabSto ::




Custom Search