|
-
Oct 22nd, 2002, 09:08 PM
#1
Thread Starter
Member
Word does not print
Hello to all,
word2000 and vb6
When I run this in debug mode, I get me letters.
If I run this in RUNTIME mode, I get no letters.
here is where I think it does not work
objWordDocuments.Application.PrintOut
Do anyone have any idea what is going on here.
I spend a week on this but could not figured it out.
thanks a bunch.
Private Sub CmdCustomerLetter_Click()
call InitilizeWord
call CheckedBoxSelected
end sub
Private Sub InitilizeWord()
'CREATE MS WORD APPLICATION OBJECT.
If TypeName(objWordApplication) = "Application" Then
Set objWordApplication = GetObject(, "Word.Application")
Else
Set objWordApplication = CreateObject("Word.Application")
End If
Set objWordDocuments = objWordApplication.Documents
Exit Sub
end sub
Private Sub CheckedBoxSelected()
Dim k As Integer
If Me.LvwCust.ListItems.Count > 1 Then
For k = 1 To Me.LvwCust.ListItems.Count
If Me.LvwCust.ListItems.Item(k).Checked Then
Call GetBkMark(k)
End If
Next k
End If
End Sub
Private Sub GetBkMark(ByVal SelItemIndex As Integer)
'*************************************************************************************************** *****************
Dim strPathName As String
Dim strFileName As String
Dim j As Integer
Dim objTemplate As Word.Document
Dim k As Integer
strPathName = App.Path & "\"
strFileName = "Customer.dot"
Set objWordDocuments = objWordApplication.Documents
'Set objTemplate = objWordDocuments.Add(strPathName & strFileName, True, wdNewBlankDocument, True)
For k = 1 To Me.LvwCust.ListItems.Count
If k = SelItemIndex Then
Set objTemplate = objWordDocuments.Add(strPathName & strFileName, True, wdNewBlankDocument, True)
With objTemplate
If .Bookmarks.Exists("CustName") Then
.Bookmarks("CustName").Range.text =Trim(Me.LvwCust.ListItems.Item(k).SubItems(2)) & " " & Trim(Me.LvwCust.ListItems.Item(k).SubItems(1)))
End If
'ADDRESS
If .Bookmarks.Exists("Address") Then
.Bookmarks("Address").Range.text = Trim(Me.LvwCust.ListItems.Item(k).SubItems(5)))
End If
objWordDocuments.Application.PrintOut
End With
End If
Next k
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|