Message 1 of 2
Late Set Workaround (Unable to provided typed object when setting object proper)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm hoping someone can provide me with some assistance.
What I'm trying to do is create a generic function that changes the object style after being called by a calling function, but works for various objects
This works fine in vba, but when I try to do it in the rule environment, it wants to force me to use a strongly type variable.
ie the code below does not work if oPL is not strongly typed. However, if you Dim oPL As PartsList, the code works just fine.
How do I get around this, so that I can use a generic object within a function, or is there someway to "late bind" the oPL object to a strong type USING the STRING of the type.
'Below code fails in vb.net/rule environment, but works fine in VBA.
Sub Main()
Dim oSheet As Sheet
oSheet = ThisApplication.ActiveSheet
oNewPLStyle = some strongly type PartsListStyle object
'Set oSheet = ThisApplication.ActiveSheet
'Set oNewPLStyle = some strongly type PartsListStyle object
Call ChangeStyle(oSheet.PartsLists, oNewPLStyle)
End Sub
Sub ChangeStyle(objColl As Object, oNewStyle As Object)
For Each obj In objColl
If Not obj.Style.Equals(oNewStyle) Then
MsgBox("here")
obj.Style = oNewStyle
End If
Next
End Sub
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization

iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type