I Have created a Function in VBA so that I can make barcodes in excel.
The font that is required to display the barcode is 'Code 128'.
Now I manual select the font but is it possible to enclose this in my VBA function?
I'm using Excel 03
I Have created a Function in VBA so that I can make barcodes in excel.
The font that is required to display the barcode is 'Code 128'.
Now I manual select the font but is it possible to enclose this in my VBA function?
I'm using Excel 03
Using Excel 2003
Hi and welcome to the forum,
This will change the activecell font. Change it to your needs :
If it doesn't work, please share your code.Please Login or Register to view this content.
GC Excel
If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.
Thanx for your quick response but it's not a Sub but a Function in VBA
I already tried that line and several other methods but the Function ignores then or I get '#value' as answer
VBA_module:
Function BarCode(ArtNr As String)
...
BarCode = "Ì" & ArtNr & ControlSign & "Î"
End Function
ArtNr is referring to a cell that contains a 5 or 6 digit number.
... contains all actions to define the ControlSign
The function BarCode calculates the ControlSign which is needed so that the system knows if it's legit.
as output you get the last line of the Function
eg.
Cell A1 contains a number (014063)
Cell B1 contains the formula: =BarCode(A1)
Cell B1 displays:"Ì014063¢Î"
When the Font is 'Code 128' you will have the barcode
UDF's are not allowed to modify the spreadsheet environment -- such as changing the format of a cell. The UDF can return the text string, but it cannot specify the font for that text string. You will either have to continue manually formatting the output cell, or put the code to format the cell into a SUB() procedure.
Originally Posted by shg
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks