The syntax for iLogic and VBA are slightly different, though both are based on Visual Basic. The primary issue with using jvj's code in VBA is that you can't use dim to declare a variable and then assign a value to it in a single line. For example:
Dim strComponent As String = InputBox("Insert Component Name")
needs to be changed to this in VBA:
Dim strComponent As String
strComponent = InputBox("Insert Component Name")
In general, VBA is split into Forms, Modules, and Class Modules. For most stuff, you'll write the bulk of the code in a module and supplement it with a userform if a gui is needed. Much of the syntax is identical to iLogic, so you should be able to see how things work if you've worked with iLogic.
Here's a piece of what I've written to change the color of all parts contained in assemblies or presentations in the active document. It's pretty rough but it gets the job done. Paste it into a module and you should be good to go.
Sub ChangePartColor()
Dim oDoc As DrawingDocument, partStr As String
If ThisApplication.ActiveDocumentType <> kDrawingDocumentObject Then
Call MsgBox("This macro only works on drawing documents.")
Exit Sub
End If
Set oDoc = ThisApplication.ActiveDocument
partStr = InputBox("Part to color:", "Prompt")
Dim oTrans As Transaction, i, j, k, c
Dim ViewCurves As DrawingCurvesEnumerator, refAssyDef As ComponentDefinition, oColor As color
Set oColor = ThisApplication.TransientObjects.CreateColor(255, 0, 0) 'RGB
Set oTrans = ThisApplication.TransactionManager.StartTransaction(ThisApplication.ActiveDocument, "Colorize [PART]")
For Each i In oDoc.Sheets
For Each j In i.DrawingViews
If j.ReferencedDocumentDescriptor.ReferencedDocumentType = kPresentationDocumentObject Then
Set refAssyDef = j.ReferencedDocumentDescriptor.ReferencedDocument.ReferencedDocuments(1).ComponentDefinition
ElseIf j.ReferencedFile.DocumentType = kAssemblyDocumentObject Then
Set refAssyDef = j.ReferencedFile.DocumentDescriptor.ReferencedDocument.ComponentDefinition
End If
For Each k In refAssyDef.Occurrences
If k.name Like partStr & ":*" Then
Set ViewCurves = j.DrawingCurves(k)
For Each c In ViewCurves
c.color = oColor
Next
End If
Next
Next
Next
oTrans.End
End Sub