【发布时间】:2014-11-29 01:39:37
【问题描述】:
我正在设置一个小程序,以便操作员扫描条形码,然后在 Excel 中创建一个并在标签打印机上打印。
我需要它在他被扫描到 10 位数代码后立即自动打印。
到目前为止,我所拥有的是 -
选项显式
Private Sub Worksheet_Change(ByVal Target As Range)
If Len(Sheet1!A2) = 10 Then
ActiveWorkbook.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Sheets("Sheet1").Range("A2").ClearContents
End If
End Sub
但这似乎不起作用。我在 Sheet1 中有这个代码。我得到的错误信息是
运行时错误“438” 对象不支持该属性或方法
它突出了 If Len 位作为问题。
有人可以帮忙吗?
【问题讨论】: