I have written code For Label Printing Using VB.
am having 6 Lines to Print on Each Label which is printing From Excel File using ODBC.6 Lines are as Follows
SimNo
Mobileno
Type Pkd On:
Valid For
MRP
on the label paper there r 8 Rows & 3 Cols of labels.
First User will type once Line 3,4,5 then Sim no & Mobile will be taken from Excel File.
so how can i use DOS Based Printing to make it faster.
& How can i manage space between two lables if User type the information in Caps Or Small
am attaching my project pls see
How can i manage space if User Is typing Caps or Small ie ASCII
how can i matter exactly on the Label as its contineous priniting for 20000 labels. on a paper there 24 labels (8 * 3)
you can set tabs for your labels, use carriage return without line feed to print the next label text on the same row at the next tab, from the beginning of the line, so it is always in the same position, you need to check that no text is too long for the label width
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
I have tried with tabs but its not working as there r three label on each row.
There r 8 rows * 3 Cols ir 24 labels on a paper.
as labels papers are contineous stationary.
print_Pos 0, (varible growing by 74mm), (varible growing by 34mm)
I had set lxPos=0 to keep the txt LeftAlign. But I did hope that you were willing to test out the values you send to this sub routine. I use an array for both growings. Like:
as you are printing directly to the printer in dos, you cannot use the vb printer object, the printer font will probably be a fixed width courier 10 (maybe with option of courier 12) (10 or 12 characters per inch) with esc codes to set bold wide or condensed etc so there are not many options the user can set, if you allow the user to choose font or size you need to print to the printer object and let widows print
most printers were considered to be 80 column (or 132 for 11"), but when set to condensed could be 136 column
using 10 as the default:
as you have 3 labels across, each label is about 25 characters width, so you must restrict your text to about 20 characters and each label is approx 3" wide, so you can do something like this (not tested)
you may need to adjust the number of spaces if 30 makes the gap too wide between labels and if they are to close vertically add another print #1
you may need to check length of data, but that can be done at some other point (where the user input the data)
in the unlikley event that your dot matrix printer does not use a fixed width font the string lengths can still be caclulated, but it is a bit more involved, if you are not using an inbuilt printer font then you are wasting your time as any windows font will need to be printed through the windows printer driver as a graphic (very slow)
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
pretty hard to do in notepad i think as all spacing depends on the fonts used
easy in WORD where you can use tables
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Even easier in VB where you can use code to move the print head in steps of about .0694 inch (1 twp). It just takes a lot of measurements and calculations or a lot of trial and error to get it right. Or use the equivalent of an Avery label - something the label manufacturer provides printing software for. Access, for example, has a Label Wizard (create a new form) that "knows" a lot of commercially available label forms. (So, IIRC, does Crystal Reports.)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana