flaviooooo
Programmer
Hi,
I have a form with a button. When you press the button it asks for a number, and that's the number of times a document will be printed. It works when I enter a value and press OK, but when I press Cancel it gives me an error: Type Mismatch
Here's the code:
Dim aantal, teller As Integer
Dim MyApp As LabelManager2.Application
Dim MyDoc As LabelManager2.Document
Dim var As LabelManager2.Variable
aantal = InputBox("How many labels?", "Labels", 0, vbOKCancel)
Set MyApp = New LabelManager2.Application
MyApp.Visible = False
Set MyDoc = MyApp.Documents.Open("C:\Program Files\CS6\Lab\GrondstoffenLeeg.Lab"
teller = 0
Do While teller < aantal '<--- here's where the error points
MyDoc.PrintDocument 2
teller = teller + 1
Loop
MyApp.Documents.CloseAll True
MyApp.Quit
Set MyApp = Nothing
I have a form with a button. When you press the button it asks for a number, and that's the number of times a document will be printed. It works when I enter a value and press OK, but when I press Cancel it gives me an error: Type Mismatch
Here's the code:
Dim aantal, teller As Integer
Dim MyApp As LabelManager2.Application
Dim MyDoc As LabelManager2.Document
Dim var As LabelManager2.Variable
aantal = InputBox("How many labels?", "Labels", 0, vbOKCancel)
Set MyApp = New LabelManager2.Application
MyApp.Visible = False
Set MyDoc = MyApp.Documents.Open("C:\Program Files\CS6\Lab\GrondstoffenLeeg.Lab"
teller = 0
Do While teller < aantal '<--- here's where the error points
MyDoc.PrintDocument 2
teller = teller + 1
Loop
MyApp.Documents.CloseAll True
MyApp.Quit
Set MyApp = Nothing