ActiveX + Codesoft
K-kOo
-
Nono76 -
Nono76 -
Hello everyone,
I am new to the world of VBS and I was asked (forced :S) to create a mini web interface application that could launch barcode printing through a well-known software in the field "Codesoft 8" by passing values from my HTML form to the printer. I've searched Google and being at an even lower level than what I've read, it would be really nice if you could help me.
My HTML code is very simple:
And for the moment the only VBS code I've found that only works halfway is this:
It opens CS8 but it closes immediately after. Do you know why?
What are the basic concepts I need to know regarding the control of CS8?
I am aware that there might not be many Codesoft experts around, but advice on VBS / ActiveX is welcome :)
Thank you
I am new to the world of VBS and I was asked (forced :S) to create a mini web interface application that could launch barcode printing through a well-known software in the field "Codesoft 8" by passing values from my HTML form to the printer. I've searched Google and being at an even lower level than what I've read, it would be really nice if you could help me.
My HTML code is very simple:
<HTML> <BODY> <FORM NAME="Feuille1"> <INPUT TYPE="hidden" name="my_var" VALUE="toto"> <INPUT TYPE="Button" NAME="Bouton1" VALUE="Clic"> <SCRIPT FOR="Bouton1" EVENT="onClick" LANGUAGE="VBScript"> <!-- --> </SCRIPT> </FORM> </BODY> </HTML>
And for the moment the only VBS code I've found that only works halfway is this:
If Not IsObject(oCS) Then Set oCS = CreateObject("Lppx2.Application") oCS.Visible = True End If It opens CS8 but it closes immediately after. Do you know why?
What are the basic concepts I need to know regarding the control of CS8?
I am aware that there might not be many Codesoft experts around, but advice on VBS / ActiveX is welcome :)
Thank you
Configuration: Windows XP Firefox 2.0.0.8
3 answers
-
Hello,
I don't do it in VBS on an HTML page, I use ActiveX Automation of Codesoft in VBA with Excel.
However, you absolutely need an Enterprise version of CS to use this ActiveX. It doesn't work with the Lite and Pro versions.
Here's an example of code:
Dim MyApp As LabelManager2.Application
Dim MyDoc As LabelManager2.Document
Public server As Integer
'Stopping CS upon closing the workbook
Sub auto_close()
If server = 1 Then MyApp.Quit
End Sub
'Launching CS (procedure called from auto_open)
Sub lance_CS()
'Error handling
On Error GoTo err_handler
Set MyApp = New LabelManager2.Application
' False CS is hidden, True CS is visible
MyApp.Visible = False
Set MyDoc = MyApp.Documents.Open(Application.ActiveWorkbook.Path & "\test.Lab")
server = 1
Exit Sub
err_handler:
server = -1
End Sub
'Prints a list
Sub imprime_liste()
For Each ligne In Range("A2:A2", Selection.End(xlDown))
posy = ligne.Row
code_a = Range("A" & posy & ":A" & posy).Text
code_b = Range("B" & posy & ":B" & posy).Text
qte = Range("C" & posy & ":C" & posy).Value
'Passing values to the label form
MyDoc.Variables("VAR_A").Value = code_a
MyDoc.Variables("VAR_B").Value = code_b
a = MyDoc.PrintLabel(qte, 1, 1, 1, 1, "")
Next ligne
MyDoc.FormFeed
End Sub
Good luck. -
Hello,
I have the same problem as you and I would like to know if, since then, you have managed to solve it.
Do you know if it's possible to open a label (file.lab) in Codesoft?
Thank you very much.
Evane -