Code:
' ===================================
' https://eileenslounge.com/viewtopic.php?p=315705#p315705
' https://eileenslounge.com/viewtopic.php?p=315689#p315689
Sub BBCodeTagsURLb() ' https://eileenslounge.com/viewtopic.php?p=315503#p315503 https://www.excelfox.com/forum/showthread.php/2860-Notes-tests-string-manipulation-of-text-files-and-string-manipulations?p=24092&viewfull=1#post24092
Rem 0 The text you selected
Dim SelTxt As String
Let SelTxt = Selection.Text ' A text I highlighted in Word
Rem 1 Some groups of name, URL, pairs
Dim strItAll As String, strEileen As String, strFox As String
Let strEileen = "Eileen's Lounge, https://eileenslounge.com/app.php/portal, eileenslounge, https://eileenslounge.com/app.php/portal, The Windows Clipboard, https://www.eileenslounge.com/viewtopic.php?p=300947#p300947, "
Let strFox = "Excel Fox, https://www.excelfox.com/forum/forum.php, excelfox, https://www.excelfox.com/forum/forum.php, "
Let strItAll = strEileen & strFox
Rem 2 Find the URL if there is one
Dim strURL As String
If InStr(1, strItAll, SelTxt, vbTextCompare) > 0 Then
Let strURL = Mid(strItAll, InStr(InStr(1, strItAll, SelTxt, vbTextCompare), strItAll, "http", vbBinaryCompare), InStr(InStr(InStr(1, strItAll, SelTxt, vbTextCompare), strItAll, "http", vbBinaryCompare), strItAll, ",", vbBinaryCompare) - InStr(InStr(1, strItAll, SelTxt, vbTextCompare), strItAll, "http", vbBinaryCompare))
Else
' Let strURL = ""
End If
Rem 3 Make the BB Code Tag URL thing
Call MakeABBCodeTagURL(strURL)
End Sub
Sub SplitytySplit_TLDRb() ' https://www.excelfox.com/forum/showthread.php/2860-Notes-tests-string-manipulation-of-text-files-and-string-manipulations?p=24093&viewfull=1#post24093
Rem 0 The text you selected
Dim SelTxt As String
Let SelTxt = UCase(Selection.Text) ' A text I highlighted in Word in UCase as part of way to get the key text search case insensitive
Rem 1 Some groups of name, URL, pairs
Dim WdEileen As String, WdFox As String
Let WdEileen = "Eileen's Lounge,eileenslounge,The Windows Clipboard,"
Let WdFox = "Excel Fox,excelfox,"
Dim Wdkey As String
Let Wdkey = UCase(WdEileen & WdFox) ' word(s) Keys like "Excel Fox, Eilen's Lounge
Dim URLEileen As String, URLFox As String
Let URLEileen = "https://eileenslounge.com/app.php/portal,https://eileenslounge.com/app.php/portal,https://www.eileenslounge.com/viewtopic.php?p=300947#p300947,"
Let URLFox = "https://www.excelfox.com/forum/forum.php,https://www.excelfox.com/forum/forum.php,"
Dim URLs As String
Let URLs = URLEileen & URLFox
'Dim SptURLs() As String
' Let SptURLs() = Split(URLs, ",") ' 1 D array of URLs like "https://eileenslounge.com, https://www.excelfox.com
Rem 2 Find the URL if there is one
Dim strURL As String
If InStr(1, Wdkey, SelTxt, vbTextCompare) > 0 Then
Let strURL = Split(URLs, ",")(UBound(Split(Split(Wdkey, SelTxt)(0), ",")))
Else
' Let strURL = ""
End If
Rem 3 Make the BB Code Tag URL thing
Call MakeABBCodeTagURL(strURL)
End Sub
Sub SplitFilter_TLDRb() ' https://www.excelfox.com/forum/showthread.php/2860-Notes-tests-string-manipulation-of-text-files-and-string-manipulations?p=24094&viewfull=1#post24094 https://eileenslounge.com/viewtopic.php?p=315620#p315620
Rem 0 The text you selected
Dim SelTxt As String
Let SelTxt = Selection.Text ' A text I highlighted in Word
Rem 1 Some groups of name_URL pairs
Dim strItAll As String, strEileen As String, strFox As String
Let strEileen = "Eileen's Lounge_https://eileenslounge.com/app.php/portal, eileenslounge_https://eileenslounge.com/app.php/portal, The Windows Clipboard,_https://www.eileenslounge.com/viewtopic.php?p=300947#p300947, "
Let strFox = "Excel Fox_https://www.excelfox.com/forum/forum.php, excelfox_https://www.excelfox.com/forum/forum.php, "
Let strItAll = strEileen & strFox
'Dim SptstrItAll() As String
' Let SptstrItAll() = Split(strItAll, ", ") ' 1 D array of pairs like eileenslounge_https://eileenslounge.com/app.php/portal The Windows Clipboard,_https://www.eileenslounge.com/viewtopic.php?p=300947#p300947,
Rem 2 Find the URL if there is one
Dim strURL As String
If InStr(1, strItAll, SelTxt, vbTextCompare) > 0 Then
' If UBound(Filter(Split(strItAll, ", "), SelTxt, True, vbTextCompare)) > -1 Then
Let strURL = Split(Filter(Split(strItAll, ", "), SelTxt, True, vbTextCompare)(0), "_")(1)
Else
' Let strURL = ""
End If
Rem 3 Make the BB Code Tag URL thing
Call MakeABBCodeTagURL(strURL)
End Sub
Sub BBCodeTagsURLDictionaryb()
Rem 0 The text you selected
Dim mydic As New Scripting.Dictionary ' Early Binding referrence https://i.postimg.cc/mgKt2QgN/Microsoft-Scripting-Runtime.jpg
Dim SelTxt As String, strURL As String
Let SelTxt = UCase(Trim$(Selection.Text)) ' A text I highlighted in Word
Rem 1 Some groups of name, URL, pairs
' Eileen's Lounge
mydic.Add UCase("Eileen's Lounge"), "https://eileenslounge.com/app.php/portal"
mydic.Add UCase("eileenslounge"), "https://eileenslounge.com/app.php/portal"
mydic.Add UCase("The Windows Clipboard"), "https://www.eileenslounge.com/viewtopic.php?p=300947#p300947"
' Excel Fox stuff
mydic.Add UCase("Excel Fox"), "https://www.excelfox.com/forum/forum.php"
mydic.Add UCase("excelfox"), "https://www.excelfox.com/forum/forum.php"
Rem 2 Find the URL if there is one
If mydic.Exists(SelTxt) Then
Let strURL = mydic(SelTxt)
' Else
End If
Rem 3 Make the BB Code Tag URL thing
Call MakeABBCodeTagURL(strURL)
End Sub
Sub MakeABBCodeTagURL(ByVal strURL As String) ' https://www.excelfox.com/forum/showthread.php/2860-Notes-tests-string-manipulation-of-text-files-and-string-manipulations?p=24092&viewfull=1#post24092
With Selection
.Text = " " & .Text & " "
.Collapse Direction:=wdCollapseEnd
.Font.Color = wdColorAutomatic
End With
End Sub
Bookmarks