Creating a Barcode and copy into Word Document (1 Viewer)

stu_c

Registered User.
Local time
Today, 04:00
Joined
Sep 20, 2007
Messages
489
Hi all
I have a word document that is populated by Access forms using the below code, in the Access form we have a REF number that is inputted into a Text box named TXTREFNumber is it possible to create a CODE-128 barcode from this and then displayed within the word document as a barcode on the word bookmark HRRefBarcode?

Code:
FUNC_CreateReportDownload
'FIND WORD FILE
    Dim oWd  As Object 'Word.Application
    Dim oDoc As Object 'Word.Document
    Dim bm   As Object 'Word.Bookmark
  
    Set oWd = CreateObject("Word.Application")
    Set oDoc = oWd.Documents.Add(CurrentProject.Path & "\TemplateFiles\HRReportTemplate.docx")

'HR RefNumber Barcode
   Set bm = oDoc.Bookmarks("HRRefBarcode")
   bm.Range.Text = [Forms]![FRM_FullCaseDetails].[Form]![TXTREFNumber]
   oWd.Visible = True


'Personal Details
   Set bm = oDoc.Bookmarks("PERSONALDETAILS")
   bm.Range.Text = [Forms]![FRM_FullCaseDetails].[Form]![StaffNumber]
   oWd.Visible = True


End Function
 

GPGeorge

George Hepworth
Local time
Yesterday, 20:00
Joined
Nov 25, 2004
Messages
2,042
If you can find a font that creates that bar-code, yes. I used a different font, 3 of 9, but it should work the same.
Create a long text field in the table so you can format it as Rich Text and specify the font you want to use. That should work for your scenario.
1710337334198.png
 

stu_c

Registered User.
Local time
Today, 04:00
Joined
Sep 20, 2007
Messages
489
Hello GPGeorge
I had issues importing to word in rich text previously under

Unfortunately never found a solution
 
Last edited:

ions

Access User
Local time
Yesterday, 20:00
Joined
May 23, 2004
Messages
792
stu_c,

I wanted to brush up on my MS Access and VBA. I believe I developed the solution that you are looking for. (See the attached zip file.) Ensure that you install Z3OF9.ttf which is the Barcode Font recommended by George and which I have used in the past.

I also show how you can strip out the HTML Tags from a Rich Text Field, so your REF number can be bolded and underlined etc... which resolves your other question Rich Text to Word
 

Attachments

  • BarcodeWord.zip
    75.4 KB · Views: 35
Last edited:

GPGeorge

George Hepworth
Local time
Yesterday, 20:00
Joined
Nov 25, 2004
Messages
2,042
stu_c,

I wanted to brush up on my MS Access and VBA. I believe I developed the solution that you are looking for. (See the attached zip file.) Ensure that you install Z3OF9.ttf which is the Barcode Font recommended by George and which I have used in the past.

I also show how you can strip out the HTML Tags from a Rich Text Field, so your REF number can be bolded and underlined etc... which resolves your other question Rich Text to Word
It's true that I created a query to print the barcode labels rather than sending them to Word or Excel.

See the other suggestions for ways to handle that.
 

Users who are viewing this thread

Top Bottom