Mike,
I found a couple of errors in my code but have now fixed it. However, the rule is unstable. If I start Inventor fresh, open the assembly, and run the rule, it will work most times. Occasionally it won't though, which is really weird. Also, once it has been ran you can't run it again until you close the assembly, reopen it, and run the rule. It is something inside the pipe (If IsPipe....) and/or flange (If IsFlange....) swap "If" that is causing it but I can't figure out what. I've tried resetting all variables to nil once the rule has finished but that doesn't work either. It acts like it is hung up somehow inside the "If" statement because it immediately tries to set the "Parameter(pNewRename, "PL") = OldpLength" and won't even open the dialog before erroring. Below is a picture of what the dialog currently looks like and the updated code is below that.
Any help is appreciated.

Rule Code :
AddReference "NozzleAdjuster1"
Sub Main
AddVbFile ("ContentCenterReplace.iLogicVb")
Dim app As Inventor.Application = ThisApplication
Dim oDoc As Inventor.AssemblyDocument = app.ActiveDocument
Dim oCompDef As Inventor.ComponentDefinition = oDoc.ComponentDefinition
Dim oCompOcc As Inventor.ComponentOccurrence
For Each oCompOcc In oCompDef.Occurrences
Dim icompDef as Inventor.ComponentDefinition = oCompOcc.Definition
Dim icompDoc as Inventor.Document = icompDef.Document
Dim iPartName As String = System.IO.Path.GetFileNameWithoutExtension(icompDoc.FullFileName)
iIsPipe = Left(iPartName, 4)
If iIsPipe = "Pipe" Then
CurrentSize = Mid(iPartName, 6, 2)
SizeChk = Mid(CurrentSize, 2, 1)
pNewNameLength = iPartName.Length
pNewNameRemainL = pNewNameLength - 7
pNewNameRemain = Mid(iPartName, 8, pNewNameRemainL)
pPartName = iPartName & ":1"
OldPlength = Parameter(pPartName, "PL")
PipeWall = Parameter(pPartName, "t")
PipeFlangeOffset = Parameter(oDoc, "d0")
CurrentNozzleProjection = Parameter(oDoc, "d4")
If SizeChk = "" Or SizeChk = " " Or SizeChk = nil Then
CurrentSize = Mid(iPartName, 6, 1)
pNewNameRemainL = pNewNameLength - 6
pNewNameRemain = Mid(iPartName, 7, pNewNameRemainL)
pNewName = iIsPipe & CurrentSize & pNewNameRemain
End If
End If
Next
Dim dlg as New ClassLibrary1.Dialog1
dlg.NozzleSize = NozzleSize
dlg.CurrentSize = CurrentSize
dlg.PipeWall = PipeWall
dlg.PipeFlangeOffset = PipeFlangeOffset
dlg.CurrentNozzleProjection = CurrentNozzleProjection
dlg.NewNozzleProjection = NewNozzleProjection
i = dlg.ShowDialog()
For Each oCompOcc In oCompDef.Occurrences
Dim compDef as Inventor.ComponentDefinition = oCompOcc.Definition
Dim compDoc as Inventor.Document = compDef.Document
Dim PartName As String = System.IO.Path.GetFileNameWithoutExtension(compDoc.FullFileName)
Dim replacer As New ContentCenterReplace(ThisDoc.Document, ThisApplication, "en-US")
Dim PfamilyName As String = "Tube & Pipe:Conduits:Pipes:ASTM A 53/A 53M Pipe"
pCCFam = "ASTM A 53/A 53M "
Dim FfamilyName As String = "Tube & Pipe:Fittings:Flanges:ASME B16.5 Flange Slip-On Welding - Class 150"
If IsFlange <> "ASME B16.5 Flange Slip-On Welding - Class 150" Then
IsPipe = Left(PartName, 4)
End If
If IsPipe <> "Pipe" Then
IsFlange = Left(PartName, 45)
End If
If(i = vbOK)Then
NozzleSize = dlg.NozzleSize
PipeFlangeOffset = dlg.PipeFlangeOffset
NewNozzleProjection = dlg.NewNozzleProjection
If NozzleSize <> "" And NozzleSize <> " " And NozzleSize <> nil Then
If IsPipe = "Pipe" Then
pNewName = IsPipe & " " & NozzleSize & " - XS - .001"
replacer.Replace(pPartName, PfamilyName, pNewName)
pNewPipeName = pNewName & ":1"
pNewReName = IsPipe & " " & NozzleSize & " - XS - " & OldPlength & ":1"
ThisDoc.Document.ComponentDefinition.Occurrences.Item(1).Name = pNewReName
Parameter(pNewReName, "PL") = OldPlength
End If
If IsFlange = "ASME B16.5 Flange Slip-On Welding - Class 150" Then
fPartName = PartName & ":1"
NewFlange = IsFlange & " " & NozzleSize
replacer.Replace(fPartName, FfamilyName, NewFlange)
End If
End If
If PipeFlangeOffset <> "" And PipeFlangeOffset <> " " And PipeFlangeOffset <> nil Then
Parameter(oDoc, "d0") = PipeFlangeOffset
End If
If NewNozzleProjection <> "" And NewNozzleProjection <> " " And NewNozzleProjection <> nil Then
Parameter(oDoc, "d4") = NewNozzleProjection
End If
End If
Next
UpdateNozzle
End Sub
Sub UpdateNozzle
InventorVb.DocumentUpdate
InventorVb.SetViewCamera(ViewCameraOption.FitExtents, New Double() {-121.30039731877672, 145.50927339213723, 145.44114957469338}, New Double() {24.208876073360443, 0, -0.068123817443847656}, New Double() {0.40824829046386318, 0.81649658092772592, -0.40824829046386313}, New Double() {76.824887490943567, 87.260303212016993})
End Sub