Adaytay
08-17-2004, 02:59 AM
Hi folks - a relatively simple problem for you.
I had a form that was issued to our claims department which they would use to log telephone claims. The form was recently redesigned to be in 'landscape' rather than 'portrait' format.
However for some reason now the autonumbering system has stopped working - rather than being in the format CLMnnnnnn, the systems' messed up the numbering sequence.
Here's the code - I've attached the document too...
Private Sub cmdPrintForms_Click()
Dim CurrentReference As String, lngReference As Long, i As Integer
If MsgBox("This will print out 10 copies of this document - proceed?", vbYesNo + vbQuestion, "Print Blanks?") = vbNo Then Exit Sub
Application.ScreenUpdating = False
Me.cmdPrintForms.Width = 0
Me.cmdPrintForms.Height = 0
For i = 1 To 10
CurrentReference = ActiveDocument.BuiltInDocumentProperties("Keywords")
lngReference = CLng(Right(CStr(CurrentReference), 6))
lngReference = lngReference + 1
CurrentReference = "CLM" & Format(lngReference, "000000")
Word.ActiveDocument.Tables(3).Cell(2, 5).Range.Text = ""
Word.ActiveDocument.Tables(3).Cell(2, 5).Range.Text = CurrentReference
ActiveDocument.BuiltInDocumentProperties("Keywords") = CurrentReference
'ActiveDocument.PrintOut Background:=True, Copies:=1
Next i
Me.cmdPrintForms.Height = 31.5
Me.cmdPrintForms.Width = 98.25
'MsgBox Copies & " documents were printed successfully!", vbOKOnly & vbInformation, "Printing Successful!"
Application.ScreenUpdating = True
' With ActiveDocument
' .Save
' .Close
' End With
'
End Sub
If anyone can help I'd be very grateful!
Ad
I had a form that was issued to our claims department which they would use to log telephone claims. The form was recently redesigned to be in 'landscape' rather than 'portrait' format.
However for some reason now the autonumbering system has stopped working - rather than being in the format CLMnnnnnn, the systems' messed up the numbering sequence.
Here's the code - I've attached the document too...
Private Sub cmdPrintForms_Click()
Dim CurrentReference As String, lngReference As Long, i As Integer
If MsgBox("This will print out 10 copies of this document - proceed?", vbYesNo + vbQuestion, "Print Blanks?") = vbNo Then Exit Sub
Application.ScreenUpdating = False
Me.cmdPrintForms.Width = 0
Me.cmdPrintForms.Height = 0
For i = 1 To 10
CurrentReference = ActiveDocument.BuiltInDocumentProperties("Keywords")
lngReference = CLng(Right(CStr(CurrentReference), 6))
lngReference = lngReference + 1
CurrentReference = "CLM" & Format(lngReference, "000000")
Word.ActiveDocument.Tables(3).Cell(2, 5).Range.Text = ""
Word.ActiveDocument.Tables(3).Cell(2, 5).Range.Text = CurrentReference
ActiveDocument.BuiltInDocumentProperties("Keywords") = CurrentReference
'ActiveDocument.PrintOut Background:=True, Copies:=1
Next i
Me.cmdPrintForms.Height = 31.5
Me.cmdPrintForms.Width = 98.25
'MsgBox Copies & " documents were printed successfully!", vbOKOnly & vbInformation, "Printing Successful!"
Application.ScreenUpdating = True
' With ActiveDocument
' .Save
' .Close
' End With
'
End Sub
If anyone can help I'd be very grateful!
Ad