Error in macro

When trying to execute the macro "Export Repo Diagram Names" an error is immediately thrown.  The error message is "Save cancelled.  Exiting."  I looked at the macro and the message is returned if exportFileName = " ".   For some reason the function GetExportFileName() is failing to properly execute, returning "".  Any help would be appreciated.  I am trying to use this macro to populate a file that will be used by the macro "Batch Delete Repository Diagrams". I have approximately 180 diagrams to delete, so manually deleting them is only an absolute last resort.  

Using ER/Studio Data Architect 17.0.2 (Build 10207)

TeamServer 17.0.2 build id: 17.0.2-201801240954 

Oracle 12.1.0.2

p.s. I've seen this error in prior versions of ERDA and TeamServer

Thanks in advance

  • To temporarily make it work you can comment out:

    'exportFileName = GetExportFileName()

    and add a line to hard code the location and name of the text file you want to create, like this:

    exportFileName = "C:\DiagramList.txt"

  • Hi,

    I believe the issue is that the macro is using the Office com objects but it's using the 32-bit versions.  I've modified the macro, which should work.

    7725.Export Repo Diagram Names v2.txt
    ' Export Repo Diagram Names v2.BAS
    ' This macro will export the names of all the diagrams in the Repository to a text file.
    ' You must first login to the Repository before running the macro.
    
    Option Explicit
    
    'Const EXPORTFILENAME = "C:\temp\list.txt"
    
    
    Sub main
    
    	If Len(DiagramManager.CurrentUser) = 0 Then
    		MsgBox "Please first login to repository before running this macro."
    		End
    	End If
    
    	On Error GoTo errHandler
    
    	doExport()
    
    	Exit Sub
    
    errHandler:
    	MsgBox "Export failed. " & Err.Description, vbCritical
    End Sub
    
    Function doExport()
    
    	Debug.Clear
    Dim exportfilename As String
    	exportfilename = GetFilePath(, ".txt", 2)
    	If exportfilename = "" Then
    		MsgBox "Save cancelled. Exiting.", vbInformation
    		End
    	End If
    
    	Dim fileHandle As Long
    	fileHandle = FreeFile
    	Open exportfilename For Output As #fileHandle
    
    	Dim so As StringObject
    	For Each so In DiagramManager.RepoDiagrams()
    		Print #fileHandle, so.StringValue
    	Next so
    
    	Close #fileHandle
    
    	Debug.Print exportfilename
    	MsgBox "Export complete.", vbInformation
    End Function
    
    Function ntrim(ByVal theString As String) As String
      Dim iPos As Long
      iPos = InStr(theString, Chr$(0))
      If iPos > 0 Then theString = Left$(theString, iPos - 1)
      ntrim = theString
    End Function