I'd like to know how to control if a replace occurrs or not in the assembly.
I am in an assembly, and I am doing a save-as of a new part (generated by
code with new part number read from an Access database). Everything works
fine, however sometimes the part is replaced with the new one, and sometimes
the old part (which the new part was created from) is kept.
I would like to know how to better control this!
"Teun Ham" wrote in message
news:406bc31c$1_3@newsprd01...
> What are you trying to accomplish exactly? (what steps do you want to
make)
> I don't see any replacement taken place in the code, only SaveAs-routines.
>
> If you want to "save-copy-as & replace" you should use the
>
"ComponentDefinition.Occurrences.ItemByName("Part:1").Replace("C:\NewPart.ip
> t", False)" (IV 8 only) to replace parts/sub-assemblies within an Assembly
> (or use the "oRefFileDesc.PutLogicalFileNameUsingFull("C:\NewPart.ipt")"
> when using Apprentice).
>
> And perhaps it is better to use "If ans = vbYes Then" (or am I
mistaken???)
>
> Cheers,
>
> Teun
>
> "Stephen Anderson" wrote in message
> news:406b2462_1@newsprd01...
> > In the lower portion of this routine (starting at ElseIf @ line 11),
when
> > saving a part (in edit mode) from an assembly document - The save-as is
> very
> > inconsistent. Sometimes, the file is saved and replaced in the
assembly,
> > and sometimes it is not replaced and only saved on our server. The
> question
> > is, what is a better way to control this?
> >
> > Thanks in advance for any help you can provide!
> >
> >
> > If ThisApplication.ActiveDocumentType = kPartDocumentObject Then
> > If oPartDoc2.FullFileName = "" Then
> > Call oPartDoc2.SaveAs(JobPath & PN & ".ipt", False)
> > Else
> > Dim ans As Integer
> > ans = MsgBox("The Current File will be Lost if not Saved,
> > Continue? ", vbYesNo)
> > If ans = 6 Then
> > Call oPartDoc2.SaveAs(JobPath & PN & ".ipt", False)
> > End If
> > End If
> > ElseIf ThisApplication.ActiveDocumentType = kAssemblyDocumentObject
> Then
> > ans = MsgBox("The Current File will be Replaced if not Saved,
> > Continue? ", vbYesNo)
> > If ans = 6 Then
> > Call oPartDoc2.SaveAs(JobPath & PN & ".ipt", False)
> > MsgBox "The Part has been changed - the new Part Number is:
"
> &
> > PN & ". An Update will show the effected change."
> > End If
> > End If
> >
> >
>
>