Results 1 to 16 of 16

Thread: DocumentBeforePrint Problem.

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Location
    Out there somewhere!
    Posts
    386

    DocumentBeforePrint Problem.

    Hello I am opening a word document and capturing the use of the print button with the following Code.

    I have the class -

    VB Code:
    1. Option Explicit
    2.  
    3. Public WithEvents objWord As Word.Application
    4.  
    5. Private Sub objWord_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
    6.  
    7.     frmApplication.txtLetterPrinted.Text = "Yes"
    8.    
    9. End Sub

    And I use this in a form -

    VB Code:
    1. Set objPrintDoc.objWord = CreateObject("Word.Application")
    2.    
    3.     With objPrintDoc.objWord
    4.         .Documents.Add Template:=strDocName
    5.         .ActiveDocument.MailMerge.OpenDataSource App.Path & "\addlist.txt", ReadOnly:=True
    6.         .ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
    7.         .ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
    8.        
    9.         .Visible = True
    10.         .Application.WindowState = wdWindowStateMaximize
    11.  
    12.     End With

    When i Was opening a .doc file, this worked fine, but I am now opening a .dot file and it has stopped working. Does anybody know why and can I fix it?


    Kev.

    "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. " - Abert Einstein
    Last edited by Kev; Jun 3rd, 2005 at 08:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width