Anybody get this to work at all

Anybody get this to work at all

Anonymous
Not applicable
289 Views
4 Replies
Message 1 of 5

Anybody get this to work at all

Anonymous
Not applicable
Hi i have tried to add a part to an active assmbly through VB in every way
possible but still cannot get it to work (Keep getting ActiveX cannot create
object errors) i have tried the help files but that is more based on macros.
Anybody willing to throw some code at me would be greatly appreciated.

Thanks Wayne
0 Likes
290 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Wayne,

Try this:
Private Sub Command1_Click()
Dim oApp As Inventor.Application 'Get object
Dim strName As String 'string for file name
Set oApp = GetObject(, "Inventor.Application")
strName = "c:\temp\part1.ipt"
Call oApp.CommandManager.PostPrivateEvent(kFileNameEvent, strName)
Call oApp.CommandManager.StartCommand(kPlaceComponentCommand)
End Sub

See "Replace Component" for almost the same thing.
Wayne, you aren't from around Knoxville are you? Mike@RTSWright
0 Likes
Message 3 of 5

Anonymous
Not applicable
Yehhaaaa this worked thank you very much. You cannot believe how long i have
tried to get this to work.
And to answer your question, no i am from South Africa->Durban.

Once again thank you.
"MDB" wrote in message
news:f098b8b.0@WebX.maYIadrTaRb...
Wayne,
Try this:
Private Sub Command1_Click()
Dim oApp As Inventor.Application 'Get object
Dim strName As String 'string for file name
Set oApp = GetObject(, "Inventor.Application")
strName = "c:\temp\part1.ipt"
Call oApp.CommandManager.PostPrivateEvent(kFileNameEvent, strName)
Call oApp.CommandManager.StartCommand(kPlaceComponentCommand)
End Sub
See "Replace Component" for almost the same thing.
Wayne, you aren't from around Knoxville are you? Mike@RTSWright
0 Likes
Message 4 of 5

Anonymous
Not applicable
Wayne,

Take a look at the AutoBolts sample that's delivered with Inventor. It does
this directly using the API, without executing the interactive command.

-Brian

"Wayne" wrote in message
news:A7CDEEC55D32B93CA37CBEBD1F16804B@in.WebX.maYIadrTaRb...
> Hi i have tried to add a part to an active assmbly through VB in every way
> possible but still cannot get it to work (Keep getting ActiveX cannot
create
> object errors) i have tried the help files but that is more based on
macros.
> Anybody willing to throw some code at me would be greatly appreciated.
>
> Thanks Wayne
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
How come people are still using late bound objects?


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Wayne,

Try this:
Private Sub Command1_Click()
Dim oApp As
Inventor.Application 'Get object
Dim strName As String 'string for file
name
Set oApp = GetObject(, "Inventor.Application")
strName =
"c:\temp\part1.ipt"
Call
oApp.CommandManager.PostPrivateEvent(kFileNameEvent, strName)
Call
oApp.CommandManager.StartCommand(kPlaceComponentCommand)
End Sub

See "Replace Component" for almost the same thing.
Wayne, you aren't
from around Knoxville are you? Mike@RTSWright

0 Likes