Batch Updating iProperties from Excel Table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone.
Not sure if this is the right forum or not, if not apologies, please let me know and I will move acordingly.
I am trying to update a number of .ipt files with a new part description based on a table of values in excel.
I have some VB code that I am using but its falling down on certain parts and Im not sure why.
Heres the situation.
I have a folder full of part files, all needing a desccription adding. There are around 1400 part files.
I have the list of these parts and their file locations populating an excel table. Just 2 columns, reading like this.
etc
Im then running this code, which I shamelessly stole.
Sub WriteData()
Dim appServer As Inventor.ApprenticeServerComponent
Set appServer = New ApprenticeServerComponent
Dim oSheet As Worksheet
Set oSheet = ThisWorkbook.ActiveSheet
For i = 2 To 15 ' DO NOT FORGET TO UPDATE!
Dim file As String
Dim Update As String
file = oSheet.Range("A" & i).Value ' columns A+B+C
Update = oSheet.Range("B" & i).Value
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
Next
End Sub
If I cycle the code through it works for all the parts up to row 10, whereby I get the following error
There isnt anything special about the part in row 10, in terms of read-only access etc?
The only thing I could think is that some of the parts may already have descriptions in them? Im guessing a bit though.
Any thoughts are most welcome. Or If anyone has a better solution for what Im trying to do that would be great.
Many thanks