aText is a very affordable text macro expander that is enabling me to do less repetitive creation. In this post, I talk about how El Capitan broke it, what is the workaround, and I cover the search feature.Read More
I wrote a Word VBA macro to do some stuff I was too lazy to do by hand. I wanted to underline lines which start with my username. Now finding and underlining text is not a big deal, but extending the selection after finding it complicates matters.
This is probably not the best way to do things but it’s a good start for me. If it helps you, send me a tweet and let me know @francisluong.
Sub underline_fluong() ' ' underline_fluong Macro ' Find instances of "fluong" which are not underlined and: ' - extend selection to end of line` ' - underline it ' Dim iCount As Integer Dim searchText As String searchText = "fluong" Selection.HomeKey Unit:=wdStory With Selection.Find .ClearFormatting .Forward = True .Wrap = wdFindContinue .Text = searchText .Font.Underline = wdUnderlineNone .Execute End With Do While Selection.Find.Found = True And iCount < 1000 iCount = iCount + 1 Selection.HomeKey Unit:=wdStory Selection.Find.Execute If Selection.Find.Found Then Selection.EndOf Unit:=wdLine, Extend:=wdExtend Selection.Font.Underline = wdUnderlineSingle With Selection.Find .ClearFormatting .Forward = True .Wrap = wdFindContinue .Text = searchText .Font.Underline = wdUnderlineNone End With End If Loop End Sub
Debating about what will be next for me. I could work on JNCIE-ENT pretty easily and add switching to my toolbox. But on the other hand I’m tempted to take some time to learn Ruby and Netconf/Sloe and/or XML interactions with routers. Screen scraping gets old. :)