all working perfectly now thank you
Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oPath As String = ThisDoc.Path
If oPath = ""
MessageBox.Show("Message", "Title", MessageBoxButtons.OK)
End If
Dim oCode As String = InputBox ("Code:", "Code","W")
Dim oThickness As String = InputBox("Thickness:", "Thickness", "2")
Dim oDia As String = InputBox("Diameter:", "Pipe diameter", "200")
Dim oAngle As String = InputBox("Angle:", "Pipe bend angle", "90")
Dim oBendRadius As String = InputBox("BendRadius:", "BendRadius", "1")
Dim oFlange As String = InputBox ("Flange:", "Flange","fb")
If System.IO.File.Exists(oPath & "\" & oCode & "_" & oThickness & "_" & oDia & "_" & oAngle & "_" & oBendRadius & "_" & oFlange & ".ipt") Then
ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oPath & "\" & oCode & "_" & oThickness & "_" & oDia & "_" & oAngle & "_" & oBendRadius & "_" & oFlange & ".ipt")
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute
Else
Dim oTemplate As String = "\\DNSERVER01\RedirectedFolders\KeithChallinor\My Documents\Inventor\test\Part1.ipt"
Dim pDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplate, False)
pDoc.ComponentDefinition.Parameters.Item("Thickness").Expression = oThickness
pDoc.ComponentDefinition.Parameters.Item("DIA").Expression = oDia
pDoc.ComponentDefinition.Parameters.Item("ANGLE").Expression = oAngle
pDoc.ComponentDefinition.Parameters.Item("BendRadius").Expression = oBendRadius
pDoc.Update
ThisApplication.UserInterfaceManager.DoEvents
pDoc.SaveAs(oPath & "\" & oCode & "_" & oThickness & "_" & oDia & "_" & oAngle & "_" & oBendRadius & "_" & oFlange & ".ipt", False)
pDoc.Close
ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oPath & "\" & oCode & "_" & oThickness & "_" & oDia & "_" & oAngle & "_" & oBendRadius & "_" & oFlange & ".ipt")
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute
End If
oAsm.Update