VB宏基本案例(1)
Sub setUnicodeFormat()
bmpFileType = ".bmp"
pngFileType = ".png"
pathA = "G:\GB18030-36x36HeiBMP(Unicode)\"
pathB = "D:\GY_150_FONT\"
Dim strA, tmpStr, strName As String
Dim count, lan As Integer
Sheets("resutle").Select
strA = Range("C" & 2).Value
count = 0
lan = 0
For i = 1 To Len(strA)
Rows((i - lan) & ":" & i).RowHeight = 32
tmpStr = Left(Mid(strA, i, Len(strA)), 1)
'strName = get_Unicode(tmpStr)
strName = GetGBKCode(tmpStr)
If Len(strName) >= 4 Then
Sheets("unicode").Select
Range("B" & (i - lan)).Value = "'" & strName
Range("A" & (i - lan)).Value = tmpStr
Range("E" & (i - lan)).Value = "CHINESE_" & strName
Range("F" & (i - lan)).Value = CLng("&H" & Range("B" & (i - lan)).Value)
Range("F" & (i - lan)).Value = "'00" & Range("F" & (i - lan)).Value & "_U" & Range("B" & (i - lan)).Value
fm = (strName) & bmpFileType
Set fs = Application.FileSearch
With fs
.LookIn = pathB
.Filename = fm
If .Execute() > 0 And Len(strName) >= 4 Then
Range("D" & (i - lan)).Select
ActiveSheet.Pictures.Insert(pathA & strName & bmpFileType).Select
Else
Range("C" & i) = "ホトシイサエ贇レ。」"
End If
End With
count = count + 1
Else
lan = lan + 1
End If
Next i
Range("k" & 1).Value = count
End Sub

浙公网安备 33010602011771号