error on mydoc.

Anyone any idea why this failes?:

Set myDoc = ActiveDocument
DocumentName = myDoc.Name
Set myReps = myDoc.Reports

For i = 1 to myReps.Count
Dim rtfFileName as String
Dim msgtext as String

Set myRep = myReps.Item(i) <== trapped here msgtext = myRep.Name

rtfFileName = "RTF File " & i
myRep.ExportAsRTF(rtfFileName)
Next i

************************************************************* Hans Kingma
Unisource Carrier Services
Industriestrasse 21
8304 Wallisellen
Switzerland
Phone: +41 1 839 32 11
Fax: +41 1 839 32 95


Listserv Archives (BOB member since 2002-06-25)

Hans:

try one of 2 things:

  1. after
    Dim msgtext as String
    add
    Dim myRep as BOReport

  2. instead of
    Set myRep = myReps.Item(i) <== trapped here
    msgtext = myRep.Name

use
msgtext = myReps.Item(i).Name

______________________________ Reply Separator _________________________________


Listserv Archives (BOB member since 2002-06-25)