هذه الأوامر ستقوم بالمهمة ، الصقها في صفحة الفورم
وقم بانشاء مربع نص text3 مخفي
هذه الوحدات النمطية استللتها من مشاركة للأخ الاستاذ ابو حمود غفر الله له ولوالديه .
Private Function NeatSplit(ByVal Expression As String, _
Optional ByVal Delimiter As String = " ", _
Optional ByVal Limit As Long = -1, _
Optional Compare As VbCompareMethod = vbBinaryCompare) _
As Variant
Dim varItems As Variant, i As Long
varItems = Split(Expression, Delimiter, Limit, Compare)
For i = LBound(varItems) To UBound(varItems)
If Len(varItems(i)) = 0 Then varItems(i) = Delimiter
Next i
NeatSplit = VBA.Strings.Filter(varItems, Delimiter, False)
End Function
Function sReplace(SearchLine As String, SearchFor As String, ReplaceWith As String)
Dim vSearchLine As String, found As Integer
Dim Swords
found = InStr(SearchLine, SearchFor)
vSearchLine = SearchLine
If found <> 0 Then
vSearchLine = ""
If found > 1 Then vSearchLine = Left(SearchLine, found - 1)
vSearchLine = vSearchLine + ReplaceWith
If found + Len(SearchFor) - 1 < Len(SearchLine) Then _
vSearchLine = vSearchLine + Right$(SearchLine, Len(SearchLine) - found - Len(SearchFor) + 1)
End If
found = InStr(vSearchLine, SearchFor)
Swords = vSearchLine
Do While found <> 0
vSearchLine = Left(vSearchLine, found - 1)
vSearchLine = vSearchLine + ReplaceWith
vSearchLine = vSearchLine + Right$(Swords, Len(Swords) - found - Len(SearchFor) + 1)
found = InStr(vSearchLine, SearchFor)
Swords = vSearchLine
Loop
sReplace = vSearchLine
End Function
Private Sub Text1_AfterUpdate()
Dim x As Variant
x = NeatSplit(sReplace([Text1], " ", ""))
For i = LBound(x) To UBound(x)
Text3 = x(i)
Next i
End Sub
Private Sub Command6_Click()
Text1.Requery
If Not IsNull(Text3) Then
Dim m
Text2 = 0
For m = 1 To Len(Text3)
Text2 = Text2 + DLookup("num", "AbjadHawwaz", "tex = '" & Mid(Text3, m, 1) & "'")
Next m
End If
End Sub