- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I've been trying to change revision date property in rev. box but I'm facing error saying that it's read-only property. What I'm looking for is that whenever I run rule, last revision date should get updated to today's date.
I'm aware of the fact that when we add new rev. row in the rev box we get today's date but my concern is when I'm about to release that drawing after 1 week I've to change it's date manually, which I don't want to do.![]()
Please check my below code, I've been able to extract and print rev date from this but not being able to change it's value. The error I'm facing is: Line 7 : "Property 'Item' is 'read only'."
Dim oDoc As Document = ThisApplication.ActiveDocument Dim oSheet As Sheet = oDoc.ActiveSheet Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1) Dim oRows As RevisionTableRows = oTable.RevisionTableRows Dim oRow As RevisionTableRow = oRows.Item(oRows.Count) Dim RevDate As String oRow.Item("DATE") = Now RevDate = oRow.Item("DATE").text MsgBox("Revision Date: " & RevDate)
@Anonymous @Ktomberlin @Owner2229 @MechMachineMan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It seems this line is the issue. You had not accessed the text to initiate the replacement.
oRow.Item("DATE") = Now
I changed this line to get it to work.
oRow.Item("DATE").Text = Now
I used this link to trace the issue
https://forums.autodesk.com/t5/inventor-customization/ilogic-revision-tables/td-p/7548318
Here is another way to write this statement and declares the RevisionTableCell
Dim oDoc As Document = ThisApplication.ActiveDocument Dim oSheet As Sheet = oDoc.ActiveSheet Dim oTable As RevisionTable = oSheet.RevisionTables.Item(1) Dim oRows As RevisionTableRows = oTable.RevisionTableRows Dim oRow As RevisionTableRow = oRows.Item(oRows.Count) Dim oCell4 As RevisionTableCell 'Get Cell to modify, Use ("Date") or (4) is date Column# counted from the left oCell4 = oRow.Item("Date") oCell4.Text = Now.ToShortDateString MsgBox("Revision Date: " & oCell4.Text)
Here is a few more date related formatting that could be useful.
'This will use computers default date formatting which maybe standardized across multiple applications by your IT department. MessageBox.Show(Today, "Title") 'https://forums.autodesk.com/t5/Inventor-forum/ilogic-Date-format/td-p/2720101 'This allows a customization of the date by changing string variable e.g "d","F" MessageBox.Show(DateTime.Now.ToString("D"), "Title") MessageBox.Show(DateTime.Now.ToString("F"), "Title") 'Search bewlow page to sub heading "Format strings and DateTimeFormatInfo properties" this will customize date format 'https://docs.microsoft.com/en-us/dotnet/api/system.globalization.datetimeformatinfo?view=net-5.0
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks so kindly for sharing @A.Acheson - that script works perfectly for updating a RevTable original entry date.