简体   繁体   English

打印标签 vba

[英]Print labels vba

I have a worksheet that has the following我有一个包含以下内容的工作表

A1 xxx
A2 yyy
A3 zzz
B1 2
B2 5
B3 7

I would like to have a macro that enables me to print the value in cells A1 & cell B1 being the number of copies to print.我想要一个宏,使我能够打印单元格 A1 和单元格 B1 中的值,即要打印的份数。 I would like it to also loop through all the items in column A.我希望它也循环遍历 A 列中的所有项目。

can't get it to work不能让它工作

Not sure I understand your question.不确定我是否理解你的问题。 But, from what you have posted, I think this is what you are trying to accomplish:但是,根据您发布的内容,我认为这就是您要完成的工作:

You have a spreadsheet that looks like this:您有一个如下所示的电子表格:

 A        B       C

1 xxx yyy zzz 2 2 5 7 3 aaa bbb ccc 4 9 4 6... 998 abc def ghi 999 8 2 3 1 xxx yyy zzz 2 2 5 7 3 aaa bbb ccc 4 9 4 6... 998 abc def ghi 999 8 2 3

And you want to manipulate some of the cells for empty cells and readjust the printout.并且您想为空单元格操作一些单元格并重新调整打印输出。 Not sure a Macro will do that.不确定宏会那样做。 That is something better suited for a program to accomplish.这是更适合程序完成的事情。 But, maybe that is not an option for you.但是,也许这不是您的选择。

Now I am presuming that you want to print this out on laser labels with sizing like 1"x2-5/8" with 3 across and 10 down.现在我假设您想将其打印在激光标签上,尺寸为 1"x2-5/8",横向 3 个,纵向 10 个。 You want your output to look like this:您希望您的 output 看起来像这样:

xxx    yyy    zzz          aaa    bbb    ccc         ddd    eee   fff


 2      5      7            9      4      6            8     2     3

I presume this is your question?我想这是你的问题? If so, here are the problems you are going to encounter:如果是这样,以下是您将遇到的问题:

  1. Labels were invented for the old days when Courier font was the de facto standard.标签是为过去的时代发明的,当时 Courier 字体是事实上的标准。 Courier will print 6 lines to an inch, and 10 characters to an inch across. Courier 将每英寸打印 6 行,每英寸打印 10 个字符。 Labels came in different sizes and number of columns across.标签有不同的大小和横跨的列数。 Today, labels are still being mfg to those standards.今天,标签仍在按照这些标准生产。 The Courier font is a fixed and non-scalable font. Courier 字体是一种固定且不可缩放的字体。 That means the letter "H" takes up the same space as the letter "i", and the font was not scalable.这意味着字母“H”占用与字母“i”相同的空间,并且字体不可缩放。

  2. Most spreadsheets are scalable in the display and with printing.大多数电子表格在显示和打印时都可以缩放。 You can use Courier fonts in the cells, and that may help you.您可以在单元格中使用 Courier fonts,这可能对您有所帮助。 But, in the end, it will be like trying to mix oil and water.但是,最终,这就像试图混合油和水一样。

  3. Your printer uses a grid to position items on the page.您的打印机对页面上的 position 个项目使用网格。 Most printers use HP's PCL language.大多数打印机使用 HP 的 PCL 语言。 For what you are doing, PCL5 will work fine.对于您正在做的事情,PCL5 可以正常工作。 Most accounting applications use a grid of 300x300 for a cubic inch on the paper.大多数会计应用程序在纸上使用 300x300 的网格作为立方英寸。 So, if you position something to print at 150,150, it will print 1/2" down and across on the page. If you print something at 1500,300 on the page, it will print at 5" across the page and 1" down. The problem with a speadsheet is that spacing is fixed differently for each font size. This means that it will start printing correctly, and slowly drift off course. Note: Ignore that fact that your printer may be a 600 dpi or a 1200 dpi printer. For printing, you can set the dpi scale to different sizes. 300dpi for sizing (not resolution) is the standard for accounting.因此,如果您 position 要在 150,150 打印一些东西,它将在页面上向下打印 1/2"。如果您在页面上打印 1500,300 的东西,它将在页面上 5" 和向下打印 1" .电子表格的问题是每个字体大小的间距固定不同。这意味着它将开始正确打印,然后慢慢偏离路线。注意:忽略您的打印机可能是 600 dpi 或 1200 dpi 打印机的事实.对于打印,你可以设置不同尺寸的dpi比例。300dpi用于尺寸调整(不是分辨率)是核算的标准。

Since this is most likely an accounting application, your office might have a Electronic Forms Software.由于这很可能是会计应用程序,您的办公室可能有电子 Forms 软件。 That is the best route to accomplish your goals.这是实现目标的最佳途径。 EFS will bridge the gap between proportional data and place it in a fixed grid format with precision and ease. EFS 将弥合比例数据之间的差距,并将其精确、轻松地放置在固定的网格格式中。

You can also try to export it to Word and set it up to print to labels.您也可以尝试将其导出到 Word 并将其设置为打印到标签。 Many word processors have the ability to print to labels.许多文字处理器都能够打印到标签。

What you are trying to do seems simple, the complexity of what happens between your spreadsheet and the printer is anything but simple.您尝试做的事情看起来很简单,电子表格和打印机之间发生的事情的复杂性绝非简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM