Hallo Benjae,
siehe
www.file-upload.net/download-2071385/SN2288959_CID_Barcode_bis_5002.xls.html
Angepasst:
Public Sub setupBarcodePages(pages As Integer, startBarcodeValue As Double, count As Integer)
Application.ScreenUpdating = False
fillPageWithBarcodes pages, startBarcodeValue + count - 1, count
setBarcodeCells pages, getBarcodeHeightFirst, getBarcodeHeightSecond, getClearTextHeightFirst, getClearTextHeightSecond
setWorksheet
Application.ScreenUpdating = True
End Sub
Sub fillPageWithBarcodes(page As Integer, startBarcodeValue As Double, count As Integer)
Dim col As Integer, row As Integer
If Not (count = 0) Then
fillPageWithBarcodes page - 1, startBarcodeValue - 1, count - 1
row = (((count - 1) \ 4) + 1) * 4
col = ((count - 1) Mod 4) + 1
Worksheets("Barcodes").Cells(
row - 3,
col).Value = Format_Code128(getContainerCode(Trim(Str(startBarcodeValue))))
' Worksheets("Barcodes").Cells(
row,
col).Value = "SID: " + getContainerCode(Trim(Str(startBarcodeValue)))
' Worksheets("Barcodes").Cells(
row - 1,
col).Value = Format_Code128(getContainerCode(Trim(Str(startBarcodeValue))))
Worksheets("Barcodes").Cells(
row - 2,
col).Value = "SID: " + getContainerCode(Trim(Str(startBarcodeValue)))
End If
End Sub
Sub setBarcodeCells(pages As Integer, heightFirst As Integer, heightSecond As Integer, clearTextHeightFirst As Integer, clearTextHeightSecond As Integer)
Dim row As Integer
If Not pages = 0 Then
setBarcodeCells pages - 1, heightFirst, heightSecond, clearTextHeightFirst, clearTextHeightSecond
If (pages Mod 4) = 1 Then
row = (pages \ 4 + 1) * 4 ' oder wie oben (ist egal) row = (((pages - 1) \ 4) + 1) * 4
Worksheets("Barcodes").Rows(
row - 3).Font.Name = "Code-128-DH"
Worksheets("Barcodes").Rows(
row - 3).VerticalAlignment = xlVAlignTop
Worksheets("Barcodes").Rows(row - 3).RowHeight = heightFirst
Worksheets("Barcodes").Rows(
row - 3).Font.Size = 22
Worksheets("Barcodes").Rows(
row - 2).Font.Name = "Arial"
Worksheets("Barcodes").Rows(
row - 2).VerticalAlignment = xlVAlignTop
Worksheets("Barcodes").Rows(
row - 2).RowHeight = clearTextHeightFirst
Worksheets("Barcodes").Rows(
row - 2).Font.Size = 12
' Worksheets("Barcodes").Rows(
row - 1).Font.Name = "Code-128-DH"
' Worksheets("Barcodes").Rows(
row - 1).VerticalAlignment = xlVAlignTop
' Worksheets("Barcodes").Rows(
row - 1).RowHeight = heightSecond
' Worksheets("Barcodes").Rows(
row - 1).Font.Size = 22
' Worksheets("Barcodes").Rows(
row).Font.Name = "Arial"
' Worksheets("Barcodes").Rows(
row).VerticalAlignment = xlVAlignTop
' Worksheets("Barcodes").Rows(
row).RowHeight = clearTextHeightSecond
' Worksheets("Barcodes").Rows(
row).Font.Size = 12
End If
End If
End Sub
Public Sub setWorksheet()
Worksheets("Barcodes").PageSetup.Orientation = xlPortrait
Worksheets("Barcodes").PageSetup.LeftMargin = Application.InchesToPoints(0.3)
Worksheets("Barcodes").PageSetup.RightMargin = Application.InchesToPoints(0.3)
Worksheets("Barcodes").PageSetup.TopMargin = Application.InchesToPoints(0.5)
Worksheets("Barcodes").PageSetup.BottomMargin = Application.InchesToPoints(0)
'Wiederholungen dieser 5 Zeilen gelöscht
Worksheets("Barcodes").Columns("A").ColumnWidth = getBarcodeWidthFirst
Worksheets("Barcodes").Columns("B").ColumnWidth = getBarcodeWidthFirst
Worksheets("Barcodes").Columns("C").ColumnWidth = getBarcodeWidthFirst
Worksheets("Barcodes").Columns("D").ColumnWidth = getBarcodeWidthFirst
'Worksheets("Barcodes").Columns("A:A").HorizontalAlignment = xlCenter
'Worksheets("Barcodes").Columns("B:B").HorizontalAlignment = xlCenter
'Worksheets("Barcodes").Columns("C:C").HorizontalAlignment = xlCenter
'Worksheets("Barcodes").Columns("D:D").HorizontalAlignment = xlCenter
Worksheets("Barcodes").Columns("A:D").HorizontalAlignment = xlCenter
End Sub
MfG Charlotte