对象变量或WITH块变量未设置
以下代码是控制标签打印机打印标签的一段,运行报错(橙色部分),请问为什么呀?Private Sub cmd_start_Click()
num_printed = 0
num_printing = printing.Caption '需要打印数量
num_printed = printed.Caption '已打印数量
num_s = "0"
Do Until num_printing = 0
If num_s = "0" Then
Set mydocs = myapp.Documents
Set mydoc = mydocs.Open(" & App.Path & " & file.Text)
num_printing = num_printing - 1
num_printed = num_printed + 1
printing.Caption = num_printing
printed.Caption = num_printed
mydoc.PrintLabel 1 这里报警,提示“对象变量或WITH块变量未设置”
End If
mydoc.FormFeed
mydocs.CloseAll
Comm
DoEvents
Loop
If num_printing = 0 Then
cmd_start.Enabled = False
End If
End Sub