0
votes

I am trying to export through a Macro in MS Word a String that has 4 numbers. The whole Macro runs just fine, but, when I open the resulting PDF, I see that the barcode displayed seems corrupt.

This is the result:

enter image description here

In the Macro, I select the text I want to format, and change the font to "Free 3 of 9 Extended".

I have tried wrapping this number with "*" characters without success. Also tried "!". None of this seems to work. The funny part is that, if I open a Word document and type the same numbers using the same font, a clear Barcode is displayed:

enter image description here

This is what I see when writing directly in MS Word the same characters using the same font,this is what I see (which is what I want to achieve in the PDF export).

My macro exports to PDF with the following code:

Public Function guardar(id As String) As String
  Dim path As String
  guardar = id
  obj_Word.ActiveDocument.ExportAsFixedFormat OutputFileName:=guardar, 
  OptimizeFor:=wdExportOptimizeForPrint, UseISO19005_1:=True, 
  IncludeDocProps:=True, KeepIRM:=True, ExportFormat:=wdExportFormatPDF
End Function
1
Please include the entire code involved in the problem. The macro that applies the format is missing. I also recommend you record a macro while typing and formatting manually then carefuly compare that with the code you already have. I seem to recall you mentioning in another post that you'd mistyped the font name, for example... - Cindy Meister
It would be helpful to know how the barcode was generated -- is in based on a font? is it an image placed in Word? - cybernetic.nomad

1 Answers

2
votes

Is it possible that the template you are given is setting the font weight to bold in that portion of the document in which you are introducing the barcode, thus modifying the way it is displayed?

I cannot think of any other reason. The code you are posting does not seem to be the culprit.