Community
Hi peeps
is there a way to compare a part number like AV075566 which has he correct prefix 2 letters and 6 numbers
looking at checking my BOM on the drawing to see if the right part number (prefix) as above
If there is a few wrong part numbers with the wrong prefix would like to export them to excel or note pad or msgbox
thanks
Something like this should work just fine.... Tweak the PartNumberCol as oProperPattern as necessary.
To understand more about what oProperPattern could look like... check out the link below:
https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/like-operator
Option Compare Text
Sub Main() Dim oDoc As Document oDoc = ThisDoc.Document
Dim oPartNumberCol As Integer
Dim oProperPattern AS string oPartNumberCol = 2
'oProperPattern = "AV*"
oProperPattern = "[A-Z][A-Z]######" For Each oSheet in oDoc.Sheets For Each oPL in oSheet.PartsLists For Each oRow in oPL.PartsListRows
oPN = oRow.Item(oPartNumberCol).Value
If Not oPN Like oProperPattern Then
oLogStr = oLogStr & vblf & oPN
End if
Next Next Next
MsgBox("Part numbers that don't match the pattern:" & vblf & oLogStr)
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.