Search code examples
vbafontsbarcodebarcode-scanner

Keep Font Results as Image?


I have an excel file that uses a unique font type to convert a raw value such as {ABCDEF|123456} to a bar code image.

Example

I need to send the file to a machine that does not have adequate permissions to install this custom font.

Is there a way to keep this font type as an image within Excel? Or to keep the font output without the font installed on the current machine?

While I have found that using Copy as Picture => Appearance: "As Shown on Screen" works manually, I can't seem to get the VBA code to work well with this as I have to do this thousands of time in a single file.


Solution

  • All you need is to copy and paste a bitmap over a cell, not a vector:

    Range("F1").Select
    Selection.CopyPicture Format:=xlBitmap
    ActiveSheet.PasteSpecial Format:="Bitmap"