Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error in print algorithm ?

Status
Not open for further replies.

sfenx

Programmer
Feb 23, 2001
81
BE
This is weird (for me anyway) ! When I try to print 1 or 2 pages, everything works just perfect. From the third page, the document is full of errors and missing parts. It can't be the document itself, because when I change the i variable to 3, there is no problem. It can't be the printer's memory, because I halted the program after each page, with the same errors as result. So in my opinion, it has to be in the code. Any help would be welcome, I really need this one to work. (I use Word2000)

Code:
  Dim oWord As Word.Application
  Set oWord = CreateObject("Word.Application")
  With oWord
    .Options.AutoFormatAsYouTypeReplacePlainTextEmphasis = False
    If Pages = 1 Then
        .Documents.Open (AppPath & DocName)
        .PrintOut False '(not in background)
        .ActiveDocument.Close
    Else
      For i = 1 To Pages
        If optSpelType(0).Value = True Then
          .Documents.Open (AppPath & DocName & " - Part " & i)
        Else
          .Documents.Open (AppPath & DocName & " - Poule " & i)
        End If
        .PrintOut False '(not in background)
        .ActiveDocument.Close
      Next
    End If
    .Quit
  End With
  Set oWord = Nothing[\code]

Sfenx8-)
 
There must be someone who can answer this...;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top