Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Compile Problem

Status
Not open for further replies.

cosmarchy

Electrical
Nov 4, 2010
10
0
0
GB
Hi,
I have the following similified code running in Excel.

Code:
    Dim objDoc As SolidEdgeDraft.DraftDocument
    
    On Error Resume Next
    
    ' Make sure SolidEdge is already open
    Set objApp = GetObject(, "SolidEdge.Application")
    If ((Err) Or (objApp Is Nothing)) Then
        MsgBox "Solid Edge must be running."
        Exit Function
    End If
    
    ' Make sure the active environment is Draft.
    If (objApp.ActiveEnvironment <> "Detail") Then
        MsgBox "You must be in the Draft environment."
        Exit Function
    End If

    For i = 0 To objApp.Documents.Count
        Set objDoc = objApp.Documents(i)
        
        If (objDoc.Type = igDraftDocument) Then
        
            objDoc.Activate

            ....
        end if
    ....    
    next

When I run it on one computer everything is fine, however when I run it on another the VBA editor gives the following error:

Compile error:
Method or data member not found

and points to the line 'If (objDoc.Type = igDraftDocument) Then'
implying objdoc does not have a type data member.

How can this run on one computer and not another.

To add to the confusion, this is an EXACT copy of another program only with a few additions which works on BOTH machines without problem!!!

Can anyone shed some light on this please?

Thanks
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top