Skip to Content
avatar image
Former Member

vba trying to open a model without opening its parent project?

I'm getting this message when I open my model with a vba program in an excel workbook. Is there a way to open the project? If so, how? If I can't what limitations exist?

Also when I try to open the mdl from the vba debugger pd crashes. Is this normal? (This seems to have been a temporary issue)


Thanks

'Option Compare Database
Option Explicit
Dim pd_App As PdCommon.Application
Dim InputModel As PdPDM.Model  ' change here as needed to CDM or PDM !
Dim STList, PDMList
Sub main()
    'Application.ScreenUpdating = False
    'Application.DisplayAlerts = False
    Dim mytable
    
    initEAModel ("C:\MYMODEL.pdm")
    
    Set mytable = InputModel.FindChildByCode("MYTABLE", cls_Table)
    If Not mytable Is Nothing Then
        Map (mytable)
    End If
    'Application.ScreenUpdating = True
    'Application.DisplayAlerts = True

End Sub
'
'  opens the Application PD and the Model YOURMODELNAME only if not loaded already!!!
'
Sub initEAModel(YOURMODELNAME)
    If pd_App Is Nothing Then
        Set pd_App = New PdCommon.Application
    End If
       
    If InputModel Is Nothing Then
        Set InputModel = pd_App.OpenModel(YOURMODELNAME)
    End If

End Sub
Sub Map(obj)
   ' Implement your method on <obj> here

end su
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers