Author Topic: Export Diagramms to RTF document with VBA  (Read 621 times)

abuechle

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Export Diagramms to RTF document with VBA
« on: September 27, 2005, 06:47:55 am »
Hi,

I'm trying to figure out how to automate the export of diagramms to a RTF document.  The hole process would include following steps:

1.) Open the right model (as in the list "recent models" in the start page)
2.) Select the the top node in the "Project View"
3.) Export diagramms to RTF document (but not embed diagramms in the document)

Does anybody have an idea how I can accomplish this via VBA? Any ideas or pointers to documentation or examples are appreciated!

Regards,
Andi Buechler

thomaskilian

  • Guest
Re: Export Diagramms to RTF document with VBA
« Reply #1 on: September 29, 2005, 03:33:47 am »
I've uploaded a Perl script some tim ago. Search for "autodoc" in this forum.

abuechle

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Export Diagramms to RTF document with VBA
« Reply #2 on: September 29, 2005, 04:30:34 am »
Thanks for the hint. I need to do it in VBA so I wrote a function that does almost the same as your perl script.

' This functions geneartes the RTF export from EA.
' Note that the model you want to export needs to be open.
Sub generate_ea_report()
   MsgBox ("Please make sure EA is up and running and the right model is choosen before you click ok.")
   Dim app As EA.app
   Dim rep As EA.Repository
   Dim project As EA.project
   Dim mId As Integer
   Dim guid As String
   Dim path As String
   Dim rtfName As String
   
   
   rtfName = "eaExport.rtf"
   path = ActiveDocument.path
   Set app = GetObject(, "EA.App")
   Set rep = app.Repository
   Set project = rep.GetProjectInterface()
   
   For mId = 0 To rep.Models.Count - 1
   If rep.Models.GetAt(mId).Name = "Views" Then
       guid = rep.Models.GetAt(mId).PackageGUID
       project.RunReport guid, "Main", path + "\" + rtfName
   End If
   Next
End Sub

Unfortunately if the model is stored on a sql server I get an error message:

"ADOB.Field[-2146825267] Either BOF or EOF is True, or the current record has been deleted. Requested operations require a current record."

After "clicking away" several of these messages the RTF report gets generated whithout any further problems.

If somebody knows what's going wrong here please let me know!

Regards,
Andi

thomaskilian

  • Guest
Re: Export Diagramms to RTF document with VBA
« Reply #3 on: September 29, 2005, 06:59:50 am »
Maybe you could trace where the error occurs?