Hi dionm,
You can try this example, but I'm not getting it to work completely. I can't recall if we can set the parts list style with the API or not (I'm thinking we can not.) I've run out of time to look at this, but thought I'd post what I had in case it helps.
This link is related and provides another possiblity (switching the object default):
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Replace-styles-in-Drawing/td-p/3594108...
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
'Set a reference to the active sheet.
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
' Set a reference to the first drawing view on the sheet. Assumes it’s not a draft view.
Dim oDrawingView As DrawingView
oDrawingView = oSheet.DrawingViews(1)
‘define the insert point
Dim oPlacementPoint As Point2d
oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d (27.8130#, 21.463#)
' Create the parts list.
oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint)
'check to see if the referenced file is a weldment
oModelDoc = ThisDoc.ModelDocument
If oModelDoc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then
'set parts list to a specific style for weldments
oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Weldment Parts List")
Else
'set parts list to a specific style for standard assemblies
oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Standard Parts List")
End if
