Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
phankinsTURWH
in reply to: WCrihfield

Ok i added some of the other code to it and it works now it looks like this. 

If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing document must be active for this code to work. Exiting.", vbCritical, "")
	Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
For Each oSheet As Sheet In oDDoc.Sheets
	For Each oBalloon As Balloon In oSheet.Balloons
		If oBalloon.Attached = False Then Continue For
		Dim oBVS As BalloonValueSet = oBalloon.BalloonValueSets.Item(1)
		Dim oDBOMRow As DrawingBOMRow = oBVS.ReferencedRow
		If oDBOMRow.Virtual Or oDBOMRow.Custom Then Continue For
		Dim oBOMRow As BOMRow = oDBOMRow.BOMRow
		Dim oCD = oBOMRow.ComponentDefinitions.Item(1)
		If TypeOf oCD Is PartComponentDefinition Then
			MsgBox("Balloon #: " & oBVS.ItemNumber & ", on Sheet: " & oSheet.Name & _
			vbCrLf & "is attach to a Part.", vbInformation, "Balloon Report")
			
		ElseIf TypeOf oCD Is AssemblyComponentDefinition Then
			MsgBox("Balloon #: " & oBVS.ItemNumber & ", on Sheet: " & oSheet.Name & _
			vbCrLf & "is attach to an Assembly.", vbInformation, "Balloon Report")
			
			Dim oDrawDoc As DrawingDocument
			oDrawDoc = ThisApplication.ActiveDocument
			Dim oStyles As DrawingStylesManager
			oStyles = oDrawDoc.StylesManager
			oBalloon.Style = oStyles.BalloonStyles.Item("SUB")
		End If
	Next
Next