Часть кода продублировалась, отредактировать сообщение не удается. Исправленно
Function GetHash(ByVal txt$) As String
Dim oUTF8, oMD5, abyt, i&, k&, hi&, lo&, chHi$, chLo$
Set oUTF8 = CreateObject("System.Text.UTF8Encoding")
Set oMD5 = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
abyt = oMD5.ComputeHash_2(oUTF8.GetBytes_4(txt$))
For i = 1 To LenB(abyt)
k = AscB(MidB(abyt, i, 1))
lo = k Mod 16: hi = (k - lo) / 16
If hi > 9 Then chHi = Chr(Asc("a") + hi - 10) Else chHi = Chr(Asc("0") + hi)
If lo > 9 Then chLo = Chr(Asc("a") + lo - 10) Else chLo = Chr(Asc("0") + lo)
GetHash = GetHash & chHi & chLo
Next
Set oUTF8 = Nothing: Set oMD5 = Nothing
End Function
Sub CommandButton1_Click()
UserForm1.Hide
txt = TextBox1 & TextBox2
res = GetHash(txt)
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://сайт/index.php?sfunc=exdata&hash=" & res & "&lg=" & TextBox1, Destination:=Range( _
"$A$1"))
.Name = "index.php?sfunc=exdata&hash="
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub