Smart questions
Smart answers
Smart people
Join Eng-Tips Forums
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Eng-Tips
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

kivancsi (Mechanical) (OP)
21 Jun 13 3:26
Hi everyone!

How can I change the activeDocument from Part to Assembly and back in an API written in Visual Basic 6?

Indeed my problem is I open a Part modify it and close it with
objDocP.Close

then open the assembly on the way

'Connect to a running instance of Solid Edge.
Set objApp = GetObject(, "SolidEdge.Application")
If Err Then
'Clear the error.
Err.Clear
'Start Solid Edge.
Set objApp = CreateObject("SolidEdge.Application")
End If
'Turn off error handling.
On Error GoTo 0
'Make the application window visible.
objApp.Visible = True
'Access the Documents collection.
Set objDocs = objApp.Documents
'Find out if any documents are open.
If objDocs.Count = 0 Then
'Add an Assembly document.
Set objDoc = objDocs.Add("SolidEdge.AssemblyDocument")
Else
'Access the currently open document.
Set objDoc = objApp.ActiveDocument
End If

and get an Error for Set objDoc

but when I put infront of Set objDoc an If

'Access the currently open document.
If objApp.ActiveDocumentType <>3 Then MsgBox objApp.Name
Set objDoc = objApp.ActiveDocument

it works, but I have to push OK button on messagebox


so the question is: how can I ater closing the PartDocument set the focus on opened AssemblyDocument?
kivancsi (Mechanical) (OP)
4 Jul 13 4:03
I have found the solution, maybe it will be useful for someone

Instead of Set objDoc = objApp.ActiveDocument the part between Else adn End If looks like this

Else
Set objDoc = objDocs.Item(1)
objDoc.Activate
End If


'remark> Item(1) since after closing the part file only the assembly file is opened

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close