Make component virtual

Hello guys,

Can someone tell me how to make a newly added part Virtual?

Here is a pretty simple code that adds a VirtualBlank part in the assembly. I just need  to make it virtual. And if anyone knows how to rename it.

Dim swApp As Object

Dim bool As Boolean

Sub Virtual()

Set swApp = Application.SldWorks

Set swAssemblyModel = swApp.ActiveDoc

' Check to see if a document is loaded

If swAssemblyModel.GetType <> 2 Then

  swApp.SendMsgToUser ("Please make sure assembly model is open and active.")

    GoTo docleanup

End If

bool = swAssemblyModel.AddComponent("w:\SolidWorks Files\SWFiles\Parts\VirtualBlank.SLDPRT", 1, 1, 1)

' Make the component virtual

'stat = bool.MakeVirtual

docleanup:

           Set swApp = Nothing

End Sub

Can someone help?

Thank you,

Alex.

SolidworksApi macros