Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-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
Joined
Nov 4, 2010
Messages
10
Location
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
 
Do you have all the same reference libraries on each machine?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top