Open part whether its loaded or not

At the moment I have a function to open parts that are already loaded and one for parts that haven't been opened, yet. But now I need one that can handle both or at least some way to determine if a part is loaded or not. How do I do that?

Sub open(number)
Dim part1 As NXOpen.Part = CType(theSession.Parts.FindObject("@DB/" + number), NXOpen.Part)

Dim partLoadStatus1 As NXOpen.PartLoadStatus = Nothing
theSession.Parts.SetActiveDisplay(part1, NXOpen.DisplayPartOption.AllowAdditional, NXOpen.PartDisplayPartWorkPartOption.UseLast, partLoadStatus1)

workPart = theSession.Parts.Work
displayPart = theSession.Parts.Display
partLoadStatus1.Dispose()
End Sub

I posted some code a while back that gathers information about an assembly. It has a function to load components; in the function you can see how to check if a component is unloaded, partially loaded, or fully loaded. See the LoadComponent function in this code:

http://nxjournaling.com/comment/718#comment-718

Edit: I should note that the code was originally written for native NX, but it should also work with Teamcenter (might need a few minor tweaks).

But you already have the component in that function, I only have the number and revision of the paart in TeamCenter.
How do I get the component?

There is SetActiveDisplay and OpenActiveDisplay which accept the number and revision and open them, but I don't know how to check which one I have to use for each part.

merci ça marche parfaitement