Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

machinemanageme

macrumors newbie
Original poster
Jun 8, 2007
2
0
We copied an Excel function written on a pc to Excel on the Mac.

The function turns the arg value into a Code128 barcode font.
The converted value has some odd characters (leading and trailing)
the barcode. I think the characters are wrong because the added
characters are pc specific characters.

Does anyone know the proper characters to add to the code 128 font
which would replace these pc specific characters.


Bret Stern

bc128C = fontString & Chr(194) & Chr(196)
Case 1 To 93
bc128C = fontString & Chr(checkDigitSubtotal + 32) & Chr(196)
Case Is > 93
bc128C = fontString & Chr(checkDigitSubtotal + 103) & Chr(196)



Function bc128C(ByVal yourData As String) As String

Dim fontString As String

Dim temp As String

Dim checkDigitSubtotal As Integer
Dim chunk As String
Dim i As Integer

fontString = Chr(183)
checkDigitSubtotal = 105
temp = yourData

For i = 1 To Len(yourData) / 2
chunk = Left$(temp, 2)
checkDigitSubtotal = checkDigitSubtotal + Val(chunk) * i
Select Case Val(chunk)
Case 0
fontString = fontString + Chr(206)
Case 1 To 93
fontString = fontString & Chr(Val(chunk) + 32)
Case Is > 93
fontString = fontString & Chr(Val(chunk) + 103)
End Select
temp = Right$(temp, Len(temp) - 2)

Next i
checkDigitSubtotal = checkDigitSubtotal Mod 103

Select Case checkDigitSubtotal

Case 0

bc128C = fontString & Chr(194) & Chr(196)
Case 1 To 93
bc128C = fontString & Chr(checkDigitSubtotal + 32) & Chr(196)
Case Is > 93
bc128C = fontString & Chr(checkDigitSubtotal + 103) & Chr(196)


End Select
End Function
 
Pc / Mac Character Sets Solved

I mapped the pc ascii character set to the equivelent Mac Roman
character set and the bar codes are printing.
 
We copied an Excel function written on a pc to Excel on the Mac.

The function turns the arg value into a Code128 barcode font.
The converted value has some odd characters (leading and trailing)
the barcode. I think the characters are wrong because the added
characters are pc specific characters.

Does anyone know the proper characters to add to the code 128 font
which would replace these pc specific characters.

Thanks for posting the solution here. But I just have one little question that where can I find the place where I can view the font design? I know the question may be a little bit stupid, but I could not find it in Mac. I just used Mac for less than one week.:)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.