I am using VB6 to create barcode for code 39, upc and ean 13 with sato cx using sbl language. I am not sure what code to use, I create a barcode but reader does not read it.
My code:
SASTextoBarra = Chr$(27) & "H00780" & Chr$(27) & "V1000" & _
Chr$(27) & " H0030 " & Chr$(27) & "V0240" & Chr$(27) & "B103100*CODE 39*"
SASTextoBarra = SASTextoBarra & Chr$(27) & "H00380" & Chr$(27) & "B103100*12345*"
I appreciate any help...
Create a simple text printer to your Sato Cx (generic printer) linked to lpt1
With VB create a text file (printout.txt)
open "c:\printout.txt" for output as #1
write the following lines
print #1,"<A>"
print #1,"<V>1000<H>30<B>10310012345"
print #1,"<Z>"
close #1
now send the printout.txt file to lpt1
you can do that by shell execute
type printout.txt >lpt1:
or create a send2printer.bat file and call it through VB
Related
If ChatBot.Caption = ("Bob" & ": " & "Hello! My name is bob. What's your name?") Then
ChatBot.Caption = vbNewLine(Text.Text & ": " & Text.Text)
This is my code so far. How do you add a new line in this case, I've been trying and searching and couldn't find a thing. With every new line from the textbox, it will add a new line to the ChatBot RichTextBox like: "[username]: blah blah".
I've found out that vbCRLF can also make a new line but honestly have no idea where to place it.
For a RichTextBox the best way is to:
'// move cursor to the end of the text
rtb.SelStart = Len(rtb.Text)
'// append the text ending with a new line
rtb.SelText = "Hello" & vbCrLf
A lesser alternative is:
rtb.Text = rtb.Text & vbCrLf & "New Line 1" & vbCrLf & "New Line 2" & vbCrLf & "New Line 3 ..."
I have the following VBscript ( based on this answer ):
Set wdApp = CreateObject( "Word.Application" )
Set wdDoc = wdApp.Documents.Open( "c:\docs_to_process\document1.docx" )
Set xlmodule = wdDoc.VBProject.VBComponents.Add( 1 )
strCode = _
"sub test()" & vbCr & _
" msgbox ""Inside the macro"" " & vbCr & _
"end sub"
xlmodule.CodeModule.AddFromString strCode
wdDoc.Save
wdDoc.Close
wdApp.Quit
The problem is: when I run it and stop the script before saving the document, I can see the macro in the opened Word file, but when I process futher, save the document and quit the script, after that if I open Word document, I see no macro in it.
What am I doing wrong?
p.s: i've provide fixed strings here for anybody else faced with same issue:
wdDoc.SaveAs "c:\docs_to_process\document1.docm", 13
wdDoc.Close
important note:
instead of just save, give document new name and point
document type as wdFormatXMLDocumentMacroEnabled it is 13 in enum list
I don't know why, but pointing enum type as
wdDoc.SaveAs "c:\docs_to_process\document1.docm", wdFormatXMLDocumentMacroEnabled
causes same error after opening file as if i just change extention
For macro the file extension should be docm i.e. macro enabled. So change the file name
wdDoc.SaveAs "c:\docs_to_process\document1.docm", wdFormatXMLDocumentMacroEnabled
I'm trying to create an input box in VB6 where I will be able to include spaces in the PROMPT. I've tried to do the same thing I do with MSGBOX but it's not letting me do VBCRLF. here's what i'm looking to do
This company has more than 1 department.
For Accounting type 1
For Reasearch type 2
input box in here and the OK and CANCEL to the right
The following code will display a multi-line prompt string:
Dim ret As String
Dim prompt As String
prompt = "This company has more than 1 department." & vbCrLf & _
"For Accounting type 1" & vbCrLf & _
"For Reasearch type 2"
ret = InputBox$(prompt)
I'm currently making a vbs that gives you 4 letters and you can enter one of them in an input box and depending on the letter it will run a certain program. I have this so far
Dim Input
A=Notepad
B=Paint
Input = InputBox("Please enter one of the listed letters!" & vbNewLine & "A. Notepad" & vbNewline & "B. Paint" & vbNewLine & "C." & vbNewLine & "D.", "Abracadabra")
and then if they entered A as an example it would run this script.
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:\windows\System32\notepad.exe"
My problem however is I can't get and if else structure working to support all 4 letters and stuff. I have no idea how to do this for syntax and how I'd structure it.
Thanks in advance
-Flare
See documentation.
https://msdn.microsoft.com/en-us/library/5h27x7e9(v=vs.84).aspx
you could try something like:
If Input = "A" Then
...
ElseIf Input = "B" Then
...
End If
The platform is windows xp x86.
I want to write a function, like pop_up_instruction(), when call it, there should be a popup dialog or notepad or command-line or whatever else to print a block of instruction on it.
the instruction contains "\r\n", like such:
Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]
/n Opens a new single-pane window for the default
selection. This is usually the root of the drive Windows
is installed on. If the window is already open, a
duplicate opens.
/e Opens Windows Explorer in its default view.
/root,<object> Opens a window view of the specified object.
/select,<object> Opens a window view with the specified folder, file or
application selected.
I wrote a function to convert the above string into a vb-string, and print it to a vbs file and call this vbs file using system(the_vbs_file), the_vbs_file content:
MsgBox "Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]" & vbCrLf & _
"" & vbCrLf & _
"/n Opens a new single-pane window for the default" & vbCrLf & _
" selection. This is usually the root of the drive Windows" & vbCrLf & _
" is installed on. If the window is already open, a" & vbCrLf & _
" duplicate opens." & vbCrLf & _
"/e Opens Windows Explorer in its default view." & vbCrLf & _
"/root,<object> Opens a window view of the specified object." & vbCrLf & _
"/select,<object> Opens a window view with the specified folder, file or" & vbCrLf & _
" application selected." & vbCrLf & _
""
Do we have other better way?
You should look at win32api:
require "Win32API"
title, message = 'dialog title', "line 1\nline 2"
Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I').call(0,message,title,0)