Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbs and code128 string generator

Status
Not open for further replies.

elly00

Technical User
Jun 30, 2011
69
IT
hi,

do you know if there are some vbs function that allows to encode a string in code128?

thanks
 
There is no standard VBS function to generate code128 or any other barcode. You'll have to brew your own. You will need a graphics package of some sort to generate the code. It is not clear whether you wish to

o display it on the screen, say in an HTML browser or wsh app
o generate a bmp/jpg/png
o generate the character sequence for encoding a string

 
hi

thanks for your reply !!
I need to obtain the character sequence for encoding as string in a variable..
I've found several examples in vba but nothing in vbs :(
 
It would be quite simple to translate from VBA to VBS: just remove the types.
 
yessss
but even if I modify the code as you said..I get error

Mmmm ;(
 
You also need to remove the $ and % signs. In VBA i, i% and i$ are 3 different variables of type real, integer and string. In VBScript, they are typeless
 
Unfortunately the vbscript help files contain following:

"Visual Basic for Applications Features Not In VBScript"
Select Case
Expressions containing Is keyword or any comparison operators
Expressions containing a range of values using the To keyword.
But Case is not really needed here anyway. So simply replace the Case loop with:

Code:
[Blue]    Dim result
    For i = 1 To Len(chaine)
        result = Asc(Mid(chaine, i, 1))
        If result < 33 Or result > 126 And result <> 203 Then
            i = 0
            Exit For
        End If
    Next[/blue]

In addition you'll need to restore a number of &s that you appear to have removed by mistake. And IIF is another VB/VBA statement not supported by VBScript

(all of which shows that translating VB to VBScript isn't quite as simple as removing types and type postfixes ;-) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top