日本人VBA写的二维码生成工具,想移植到vb6.0,写com组件,不废话,直接上代码
vba原代码
Private m_fs As Object
Public Function QR(ByVal s As String, _
Optional ByVal charsetName As String = "Shift_JIS") As Variant
If m_fs Is Nothing Then
Set m_fs = CreateObject("Scripting.FileSystemObject")
End If
On Error GoTo Catch
If Not (TypeOf Application.Caller Is Range) Then Exit Function
Dim rng As Range
Set rng = Application.Caller.MergeArea
Call DeleteShape(rng)
If Len(s) = 0 Then Exit Function
Dim sbls As Symbols
Set sbls = CreateSymbols(charsetName:=charsetName)
Call sbls.AppendText(s)
Dim filePath As String
filePath = "D:\test.jpg"
Dim shp As Shape
Set shp = AddPicture(filePath, rng)
Call FillShape(shp, vbWhite)
QR = ""
Finally:
On Error GoTo 0
Exit Function
Catch:
QR &#