Thanks, but it doesn't work
I have made an other test and in fact I'm not able to link to the Documents
collection:
1. I open Inventor
2. I open some part file (one.ipt, two.ipt)
3. I run this code:
Dim oApp As Inventor.Application
Set oApp = GetObject(, "Inventor.Application")
Dim oDocs as Inventor.Documents
Set oDocs = oApp.Documents
4. I inspect the oApp variable (with VB WATCH) and I open in the tree the
Documents collection (I have 2 item)
5. I inspect the oDocs variable and the value was Nothing
The same code in VBA work.
Help ???
"Brian R. Iwaskewycz"
ha scritto nel
messaggio news:54F223059A3E7DA497533409ECAF8C06@in.WebX.maYIadrTaRb...
> I don't think an external VB app is able to determine the document type
> before it's opened. Try changing the line to Dim oDoc as
Inventor.Document.
>
> I haven't tried this so I'm not sure if that's the answer or not (I don't
> have VB).
>
> "Alessio" wrote in message
> news:8E58247214C25F6D2877D3C77A866694@in.WebX.maYIadrTaRb...
> > Why when I try to open a part document with VB id doesn't work? I
obtained
> a
> > VB error 13 Type Mismatch
> >
> > Dim oApp As Inventor.Application
> > Set oApp = GetObject(, "Inventor.Application")
> >
> > Dim oDoc As Inventor.PartDocument
> > Set oDoc = oApp.Documents.Open("c:\mypart.ipt")
> >
> > If I try the same code from VBA it works fine:
> >
> > Dim oDoc As Inventor.PartDocument
> > Set oDoc = ThisApplication.Documents.Open("c:\mypart.ipt")
> >
> >
> >
>
>