- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a requirement to add iproperties (checked by, checked date, design state, etc.) for a list of drawings.
I want to add these iproperties in Inventor from an excel using vba macros.
Please help me to create an excel vab macro to control Inventor and perform the above operations automatically.
Regards,
Mohammed Shuaib K
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For this task is better to start from Excel VBA. You can add reference to "Inventor Object Library" and then you can use Inventor.ApprenticeServer for writing data to iProperties. Apprentice has the best performance for this tasks.
Excel VBA example:
Sub WriteData()
Dim appServer As Inventor.ApprenticeServerComponent
Set appServer = New ApprenticeServerComponent
Dim oSheet As Worksheet
Set oSheet = ThisWorkbook.ActiveSheet
For i = 2 To 3
Dim file As String
Dim checkedBy As String
Dim checkedDate As Date
file = oSheet.Range("A" & i).Value
checkedBy = oSheet.Range("B" & i).Value
checkedDate = oSheet.Range("C" & i).Value
Dim invDoc As Inventor.ApprenticeServerDocument
Set invDoc = appServer.Open(file)
invDoc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Checked By").Value = checkedBy
invDoc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Date Checked").Value = checkedDate
invDoc.PropertySets.FlushToFile
invDoc.Close
Next
End Sub
Test data preview:
Test data preview
Add reference to Inventor in Excel VBA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Getting the above error while running the code?
Please help me fix this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I don't know what error you get. My code works, but omits error handling for clarity.
- You need registered Inventor correctly.
- Opened file must exists.
- Opened file can't be newer then registered Inventor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello @Michael.Navara
could you tell me where is the VBA Project - References tab is located. thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Full example is in attachment. Extract files to C:\Temp\*.*
Open "Data.xlsm" and included VBA project.
References tab is located here:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Bro,
When i want to change from "checked by" to other one or use custome properties, how can i do?
Many thank