Hi @andrew_canfield. If I were you, I would actually be moving away from VBA, at least for right now, because it has some serious security problems, which is why Autodesk stopped including the VBA editor in any of their Inventor installs starting in 2021 (Link). Also, it uses a much older coding system than the vb.net system that iLogic uses. The 'InputListBox' is not available in VBA, so if that is critical to this process, you may want to stick to iLogic for this one. The alternatives are to use a regular 'InputBox' or design a VBA UserForm that includes something like a ListBox control for use in these types of cases, and call that when you need something like that.
Anyways, here is the VBA version of your iLogic code, except for the InputListBox part, of course.
Sub SetDrawingScaleFromList() 'Scale the Drawing - Note your drawing views names("VIEW1")&("VIEW4") must match the template
If ThisApplication.ActiveDocumentType <> kDrawingDocumentObject Then Exit Sub
Dim oDDoc As DrawingDocument
Set oDDoc = ThisApplication.ActiveDocument
Dim oUParams As UserParameters
Set oUParams = oDDoc.Parameters.UserParameters
Dim oUParam As UserParameter
On Error Resume Next 'pause normal error handling
Set oUParam = oUParams.Item("Scaler")
If Err <> 0 Then
Err.Clear
Set oUParam = oUParams.AddByValue("Scaler", "1:5", UnitsTypeEnum.kTextUnits)
If Err <> 0 Then Exit Sub
End If
On Error GoTo 0 'resume normal error handling
'On Error GoTo Exiter
Dim oScales() As String
oScales = Array("1:1", "1:2", "1:4", "1:5", "1:10", "1:20", "1:25", "1:50", "1:100")
oUParam.ExpressionList.SetExpressionList (oScales)
'there is no 'InputListBox' in VBA, so you would have to either:
'- use a regular 'InputBox', which can not show a list to select from
'- or create a VBA UserForm with a ListBox in it, then call that to show the list of options
Dim Scaler As String
'Scaler = InputListBox("Set Drawing Scale", MultiValue.List("Scaler"), Scaler, Title:="Scale = " & ActiveSheet.View("VIEW1").ScaleString, ListName:="List")
Scaler = InputBox("Set Drawing Scale", "Set Drawing Scale", "1:10")
Dim oViews As DrawingViews
Set oViews = oDDoc.ActiveSheet.DrawingViews
Dim oView As DrawingView
For Each oView In oViews
If oView.Name = "VIEW1" Then
oView.ScaleString = Scaler
ElseIf oView.Name = "VIEW4" Then
oView.ScaleString = Scaler
End If
Next
oUParam.Delete
Exiter:
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)