Hallo zusammen,
ich möchte gerne folgendes umsetzen: Bulk Erstellung von QR Codes in Excel. Funktioniert auch soweit, aber ene Funktion fehlt mir noch. Und zwar generiert es schon die QR Codes, aber ich möchte gerne den Inhalt von mehreren Spalten verarbeiten lassen. Momentan ist es immer nur die erste oder je nachdem was ich definiere. Ich habe schon mit RangeCell probiert mehrere erfassen zu lassen, aber das verträgt sich mit dem Skript alles nicht. Skript ist dieses hier:
Dim wsh As Worksheet
Set wsh = Application.ActiveSheet 'QR codes are generated on the active worksheet
Dim shp As Shape
For Each shp In wsh.Shapes 'Deletes all barcode pictures which are generated previously
If shp.Type = msoPicture And InStr(shp.Name, "BarcodePicture") > 0 Then
shp.Delete
End If
Next
Dim ss As StrokeScribeClass 'Invisible COM server
Set ss = CreateObject("STROKESCRIBE.StrokeScribeClass.1")
ss.Alphabet = QRCODE
pict_path = wsh.Parent.Path + "\bar.wmf" 'A temporary file for pictures
Row = 1
Do
Dim data As String
data = wsh.Cells(Row, 1) 'Data for barcodes is taken from the first column
If Len(data) = 0 Then Exit Do 'The code will stop execution on first empty cell occurrence
ss.text = data
rc = ss.SavePicture(pict_path, WMF, 1440, 1440) 'A 1x1 inch QR Code is stored in a temporary file. 1440 TWIPs=1in.
If rc > 0 Then 'Reports the error if SavePicture() call was unsuccessful
MsgBox ss.ErrorDescription
Exit Do
End If
Set qrcode_cell = wsh.Cells(Row, 2) 'The cell where the QR Code will be placed
'The rectangle which fits into the cell. QR codes are square in shape.
qrcode_size = Application.Min(qrcode_cell.Width, qrcode_cell.Height)
'Barcode picture is loaded from file and centered in the cell:
Set shp = wsh.Shapes.AddPicture(pict_path, msoFalse, msoTrue, _
qrcode_cell.Left + (qrcode_cell.Width - qrcode_size) / 2, _
qrcode_cell.Top + (qrcode_cell.Height - qrcode_size) / 2, _
qrcode_size, qrcode_size)
'Each picture is named as BarcodePictureN, where N is 1,2,3...
'So the pictures can be easily removed next time
shp.Name = "BarcodePicture" & Format(Row)
Row = Row + 1 'Going to the next worksheet row
Loop
Kill pict_path 'We don't need the temporary picture file any more
Set ss = Nothing 'Deletes the barcode COM server
Quelle:
https://strokescribe.com/en/qr-code-excel-word-csharp-javascript.html
Hat jemand eine Idee, wie ich das beheben könnte? Vielen Dank und beste Grüße
Andre
|