Results 1 to 10 of 193

Thread: Appendix Thread 2. ( Codes for other Threads, HTML Tables, etc.)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Coding and possibly later extra notes for these main forum postings
    https://eileenslounge.com/viewtopic....323547#p323547
    https://www.excelfox.com/forum/showt...ll=1#post17882


    Code:
    Private Function DBugPrntArr(ByVal Arr As Variant) As Variant
    'ReDim DBugPrntArr(LBound(Arr) To UBound(Arr))
    Dim Var As Variant: ReDim Var(LBound(Arr) To UBound(Arr))
    Dim Eye As Long, strOut As String
        For Eye = LBound(Arr) To UBound(Arr)
         Let Var(Eye) = Arr(Eye)
         Let strOut = strOut & Arr(Eye) & ", "
        Next Eye
     Let strOut = "{" & Left(strOut, Len(strOut) - 2) & "}" '    Left(strOut, Len(strOut - 2))  is  Take off last  comma and space
    Debug.Print strOut
    Stop ' Check watch window on var    '  https://i.postimg.cc/fytpYm4V/Byte-Array.jpg
    End Function
    Private Sub StrConvBSTR()  '   https://www.excelfox.com/forum/showthread.php/2824/page2#post17882
    Rem 0
    Dim Bite As Byte: Let Bite = 0: Let Bite = 255 ' : Let Bite = 256     Let Bite = -1  ' Runtime error '6' Overflow
    Dim ByteArr() As Byte
    Dim BSTR As String, VBABString As String '   The Unicode character array that is pointed to by a BSTR must be preceded by a 4-byte length field and terminated by a single null 2-byte character (ANSI = 0)
     Let BSTR = "help": Debug.Print BSTR     ' help
     Let VBABString = BSTR         '   The variable  VBABString  is a pointer   to  the VB  pointer
     Let ByteArr() = BSTR    ' ### '   coerce string to array of bytes      ' 104 0 101 0 108 0 112 0
     ' 0b  https://eileenslounge.com/viewtopic.php?p=323085#p323085    https://eileenslounge.com/viewtopic.php?p=297500#p297500 (Second half)
    ' https://www.excelfox.com/forum/showthread.php/2824/page2#post17880
    Rem 1 … ... Unicode?
    Dim UnicChrArr As String, vTemp As Variant
     Let BSTR = "Alan"
     Let UnicChrArr = StrConv(BSTR, vbUnicode)
     ' Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(UnicChrArr) ' "h" & Chr(0) & "e" & Chr(0) & "l" & Chr(0) & "p" & Chr(0)
    
    
    ' 1b
      Let ByteArr() = StrConv(BSTR, vbUnicode)  ' ###                 ' 65 0 0 0 108 0 0 0 97 0 0 0 110 0 0 0
    Call DBugPrntArr(ByteArr()) '  {65, 0, 0, 0, 108, 0, 0, 0, 97, 0, 0, 0, 110, 0, 0, 0}    https://i.postimg.cc/qR2yq8xJ/Byte-Array-Unicode.jpg
    ' Let strArr() = StrConv(BSTR, vbUnicode) ' Type mismatch
      Let vTemp = StrConv(BSTR, vbUnicode)
     ' Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(vTemp)      ' "A" & Chr(0) & "l" & Chr(0) & "a" & Chr(0) & "n" & Chr(0)
    ' 1d
     Let ByteArr() = StrConv(StrConv(BSTR, vbFromUnicode), vbUnicode) ' 65 0 108 0 97 0 110 0
     Let vTemp = StrConv(StrConv(BSTR, vbFromUnicode), vbUnicode)     ' "Alan"
    Dim strArr() As String
     Let strArr() = Split(UnicChrArr, vbNullChar)                                        ' "A" "l" "a" "n" ""                                                               https://www.vbforums.com/showthread.php?526299-How-can-you-split-a-string-into-all-its-characters&p=3252316&viewfull=1#post3252316    http://gaffiprog.blogspot.com/2013/04/golfing-tip-vba-split-string-into.html
     Let strArr() = Split(Left(UnicChrArr, Len(UnicChrArr) - 1), vbNullChar) ' "A" "l" "a" "n"
    ' 1e
     Let strArr() = Split(Left(StrConv(BSTR, vbUnicode), Len(StrConv(BSTR, vbUnicode)) - 1), vbNullChar) ' "A" "l" "a" "n"   https://i.postimg.cc/7PQjwS7R/text-to-array.jpg
    
    Rem 2 "Unicode To ANSI"
    Debug.Print StrConv(BSTR, vbFromUnicode) ' ??  ' VB's "No idea how to display these characters as I don't even know what they are" (sometimes you might get a character, if the unicode byte pattern coincidentally matches a character in the current code page)
     Let vTemp = StrConv(BSTR, vbFromUnicode)
    Debug.Print vTemp ' ??                         ' VB's "No idea how ...
    ' Let strArr() = StrConv(s, vbFromUnicode) ' Type mismatch
    Dim varArr() As Variant
    ' Let varArr() = StrConv(s, vbFromUnicode) ' Type mismatch
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  '  65 108 97 110
    Debug.Print ByteArr()                          ' VB's "No idea how to ...
     Let ByteArr() = StrConv("Alan", vbFromUnicode) ' 65 108 97 110
    Call DBugPrntArr(ByteArr())      ' {65, 108, 97, 110}     '   https://i.postimg.cc/fytpYm4V/Byte-Array.jpg
    ' 2b Looking at a few characters of later interset
     Let BSTR = "help" & ChrW(8230)   '  "help" & "…"           8230      2026  …
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 133        ' https://i.postimg.cc/tTzWvZQN/Character-number-133-across-the-board.jpg
     Let BSTR = "help" & ChrW(133)  '    133 …               …        horizontal ellipsis        …       133      85 …   NEL   Next Line
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 65
     Let BSTR = "help" & Chr(133)  '    133 …               …        horizontal ellipsis        …       133      85 …   NEL   Next Line
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 133
     Let BSTR = "help" & "…"
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 133
     
     Debug.Print AscW(ChrW(8230)) ' 8330                  Wiki says
     Debug.Print Asc(ChrW(133))   '   63     ( 63 is ? )  Wiki says NEL   Next Line
     Debug.Print Asc(Chr(133))    '  133
     Debug.Print Asc("…")         '  133
     Debug.Print AscW("…")        ' 8230
      
     Let BSTR = "help" & ChrW(1000)  '            1000      3E8   ?   ?           Coptic Capital Letter Hori  Greek and Coptic
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 63    63 is ?
    ' 1c That Greek slanted AE which seems to have ChrW(482) and Chr(198)
     Let BSTR = "help" & ChrW(482)  '  (AE thing)   482      1E2    ?   ?        Latin Capital Letter ? with macron  for Sami   Phonetic & historic letters
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 63    63 is ?
    
     Let BSTR = "help" & ChrW(198)  '  (AE thing)  Latin Capital Letter ? with macron  for Sami    also    '    198 Æ               ?        Latin capital letter AE        Asc(left(range("A1").Value,1)) is 65    AscW(left(range("A1").Value,1)) is 198      198 Æ               ?        Latin capital letter AE        ?       198      C6 ?   ?      Latin Capital letter ?   "Letters: Uppercase ""
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 198
    Debug.Print "Æ" & " " & Asc("Æ") & " " & AscW("Æ") '  Æ 198 198
     Let BSTR = "help" & ChrW(65535)  '              65535      FFFF ?
     Let ByteArr() = StrConv(BSTR, vbFromUnicode)  ' 104 101 108 112 63
    
    ' 1d Showing perhaps the ignorance
     Let UnicChrArr = "A" & vbNullChar & "E" & vbNullChar
    Debug.Print UnicChrArr '   A E
    Debug.Print StrConv(UnicChrArr, vbFromUnicode) ' AE
     Let ByteArr() = StrConv(UnicChrArr, vbFromUnicode)
    
    End Sub
    

    Ref
    https://www.eileenslounge.com/viewto...297326#p297326 https://www.eileenslounge.com/viewto...297329#p297329
    https://eileenslounge.com/viewtopic....323085#p323085
    https://www.excelfox.com/forum/showt...age2#post17880
    Last edited by DocAElstein; 12-30-2024 at 04:12 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. VBA to Reply All To Latest Email Thread
    By pkearney10 in forum Outlook Help
    Replies: 11
    Last Post: 12-22-2020, 11:15 PM
  2. Appendix Thread. Diet Protokol Coding Adaptions
    By DocAElstein in forum Test Area
    Replies: 6
    Last Post: 09-05-2019, 10:45 AM
  3. Replies: 19
    Last Post: 04-20-2019, 02:38 PM
  4. Search List of my codes
    By PcMax in forum Excel Help
    Replies: 6
    Last Post: 08-03-2014, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •