T
Ted
Hi all, i build an application that opens up a word document and prints it
to the printer if the checkbox is selected. i'd like to instead insert the
document to the end of the document that is already open or copy the form
and paste it at the end. what ever makes more sense. can anyone point me in
the right directions?
For Each ctrl In Me![sfmStateForms].Form.Controls
If TypeOf ctrl Is CheckBox And ctrl.Tag = "Mandatory" Then
If ctrl.Value = True Then
Err.Number = 0
On Error GoTo notloaded2
Set objWord = GetObject(, "Word.Application")
notloaded2:
If Err.Number <> 0 Then
Set objWord = CreateObject("Word.Application")
End If
objWord.Visible = True
objWord.Documents.Open FileName:="L:\Glencoe\Forms\" &
Right(ctrl.Name, Len(ctrl.Name) - 3) & ".doc"
objWord.ActiveDocument.PrintOut
objWord.ActiveDocument.Close SaveChanges:=0
Set objWord = Nothing
PauseCode 'Pauses the code for 1 second to see if printouts will
come out in order
End If
End If
Next
TIA
Ted
to the printer if the checkbox is selected. i'd like to instead insert the
document to the end of the document that is already open or copy the form
and paste it at the end. what ever makes more sense. can anyone point me in
the right directions?
For Each ctrl In Me![sfmStateForms].Form.Controls
If TypeOf ctrl Is CheckBox And ctrl.Tag = "Mandatory" Then
If ctrl.Value = True Then
Err.Number = 0
On Error GoTo notloaded2
Set objWord = GetObject(, "Word.Application")
notloaded2:
If Err.Number <> 0 Then
Set objWord = CreateObject("Word.Application")
End If
objWord.Visible = True
objWord.Documents.Open FileName:="L:\Glencoe\Forms\" &
Right(ctrl.Name, Len(ctrl.Name) - 3) & ".doc"
objWord.ActiveDocument.PrintOut
objWord.ActiveDocument.Close SaveChanges:=0
Set objWord = Nothing
PauseCode 'Pauses the code for 1 second to see if printouts will
come out in order
End If
End If
Next
TIA
Ted