SOLVED

Printing a cell to a small label

Copper Contributor

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!

3 Replies
best response confirmed by gjameric2090 (Copper Contributor)
Solution

@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.

HansVogelaar_0-1714743587271.png

 

@Hans Vogelaar Thanks - I'll try that when I get back in the office on Monday.

Thanks for your help. I had to use ChatGPT to convert the dimension into the appropriate values, but otherwise, works great! Thanks!
1 best response

Accepted Solutions
best response confirmed by gjameric2090 (Copper Contributor)
Solution

@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.

HansVogelaar_0-1714743587271.png

 

View solution in original post