12-26-2022
11:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
12-26-2022
11:00 AM
Hi @chris.barrie I am not sure if you got this solved but it was likely an error within the excel sheet when reading the cells. See this link.
For anyone else looking to implement this code. Here are the steps.
This code needs to run in Excel VBA and not Inventor VBA. The code is using the apprentice server to perform the iProperties changes. For this reason it cannot use Inventor VBA. The benefits are that you can continue to use inventor while the code is running. Here is a link to an article showing more information. You will need to add reference to the Inventor Object Library within References.
'https://modthemachine.typepad.com/my_weblog/2010/03/iproperties-without-inventor-apprentice.html
'Add reference to Autodesk Inventor Object Library. In VBA editor Tools, Add Reference ....
Sub WriteData()
Dim appServer As Inventor.ApprenticeServerComponent
Set appServer = New ApprenticeServerComponent
Dim oSheet As Worksheet
Set oSheet = ThisWorkbook.ActiveSheet
For i = 2 To 15
Dim file As String
Dim Update As String
file = oSheet.Range("A" & i).Value
Update = oSheet.Range("B" & i).Value
If file = "" Then GoTo NextIteration
Dim invDoc As Inventor.ApprenticeServerDocument
Set invDoc = appServer.Open(file)
invDoc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Description").Value = Update
invDoc.PropertySets.FlushToFile
invDoc.Close
NextIteration:
Next
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan
Or if this helped you, please, click (like)
Regards
Alan