Forum Discussion

gjameric2090's avatar
gjameric2090
Copper Contributor
May 03, 2024
Solved

Printing a cell to a small label

Dear all, 

 

I have created an Excel document that creates a document library code using VBA based on user input.

 

e.g.

Company = A

Type of Document = B

Date of Execution = C 

 

and so on.

 

Based on what the user enters, when they click the create code button, some VBA runs in the background and creates a document code e.g. US-ABC-E-123-1

 

The intent is for that document code that is created in cell B5 to be printed on to a 45x15mm label via our Zebra label printer. However I am struggling to find a way to get excel to print the contents of just that cell at the right size. 

 

The current workaround is that clicking a print button on the worksheet which opens a template in word (which is 45x15), pastes in the code, and then the user prints it in the normal File-Print dialog. 

 

Any ideas on how to solve this issue would be very very much appreciated!

  • gjameric2090 

    Try setting the height and the width of the cell to the appropriate values, and to set the Print Area of the worksheet to that cell.

     

3 Replies

  • gjameric2090 

    Try setting the height and the width of the cell to the appropriate values, and to set the Print Area of the worksheet to that cell.

     

      • gjameric2090's avatar
        gjameric2090
        Copper Contributor
        Thanks for your help. I had to use ChatGPT to convert the dimension into the appropriate values, but otherwise, works great! Thanks!

Resources