Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default UDF problem in converting data into code 128 B

Function Format_Code128 (InString As String) As String
Dim Sum As Integer, i As Integer
Dim Checksum As Integer, Checkchar As Integer
Dim MyString As String, CVal As Integer


' Initialize running total with value of
' Subset B start character

Sum = 104

' Scan the string and add character value times position

For i = 1 To Len(InString)

' Copy one character from InString position i to MyString

MyString = Mid$(InString, i, 1)

' Get the numeric value of the character and subtract
' 32 to shift (the space character, ASCII value 32, has
' a numeric value of 0 as far as Code 128 is concerned)

CVal = Asc(MyString) - 32

' Add the weighted value into the running sum

Sum = Sum + (CVal * i)
Next i

' Calculate the Modulo 103 checksum

Checksum = Sum Mod 103

' Now convert this number to a character.

If Checkdigit = 0 Then
Checkchar = 174
ElseIf Checkdigit < 94 Then
Checkchar = Checkdigit + 32
Else
Checkchar = Checkdigit + 71
End If
'
' Now format the final output string: start character,
' data, check character, and stop character
'
MyString = Chr(162) + InString + Chr(Checkchar) + Chr(164)
Format_Code128 = MyString
End Function

I Have coded above UDF to construct data (my data is like "CCF001257") the
UDF returns value as

¢CCF001257®¤ but when I changed this into 128 font and took printout the
scanner is not reconging it..what will be the problem..will any one trace out
...i have a doubt..
1.code 128 and code 128 B fonts are different if so..
2. shall i have to use Code 128 B font

does this will slove..

Plz tell me soon...

Regards,

safi.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro question Chris Excel Worksheet Functions 12 July 7th 06 01:23 AM
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 08:03 AM
Printing data validation scenarios SJC Excel Worksheet Functions 14 July 24th 05 12:43 AM
External data Macro Problem Excel 97 Craig Kelly Excel Discussion (Misc queries) 1 January 17th 05 03:17 PM


All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"