Revision table collumn width change

Revision table collumn width change

k14348
Advocate Advocate
1,079 Views
7 Replies
Message 1 of 8

Revision table collumn width change

k14348
Advocate
Advocate

Hi,

 i need to change revision table collumn width via vba anybody have this code?

 

by

karthikeyan

0 Likes
Accepted solutions (1)
1,080 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

Hi,

 

Hope this code will full fill your requirement.

 

Sub Change_Revision_table_width()

Dim oDoc As Document
Dim oSheet As Sheet
Dim oRevisionTables As RevisionTable
Dim oRevisionTableColumn As RevisionTableColumn
Dim oColumnName As String
Dim oWidth As Double

Set oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kDrawingDocumentObject Then
Set oSheet = oDoc.ActiveSheet
oSheet.Activate
For Each oRevisionTables In oSheet.RevisionTables
For Each oRevisionTableColumn In oRevisionTables.RevisionTableColumns
oColumnName = oRevisionTableColumn.Title
oWidth = InputBox("Enter the width of the Column Name : " + oColumnName + "", "Enter Column Width")
oRevisionTableColumn.Width = oWidth
Next
Next
Else
MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Revision Table Column Width:"
Exit Sub
End If
End Sub

 

 Please accept this as solution if it resolves your requirement

0 Likes
Message 3 of 8

k14348
Advocate
Advocate

Thank for your help. Its working .I need some modification in this coding something like 

 

If revTable.RevisionTableColumns.Item(colIndex).PropertyType = kRevisionTableCustomProperty And _

           revTable.RevisionTableColumns.Item(colIndex).Title = "Rev. Date" Then

   oWidth="5"         

oRevisionTableColumn.Width = oWidth

            End If

I don't know how to include this. Plz help.

My table is constant every time it won't change. some adjustment has to be done in some collumns

 

Thank you,

karthikeyan M

 

0 Likes
Message 4 of 8

Anonymous
Not applicable
Accepted solution

Hi Karthik,

 

I've modified the code as you need. Hope this gonna solve your issue.

 

Sub Change_Revision_table_width()
Dim oDoc As Document
Dim oSheet As Sheet
Dim oRevisionTables As RevisionTable
Dim oRevisionTableColumn As RevisionTableColumn
Dim oColumnName As String
Dim oWidth As Double
Set oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kDrawingDocumentObject Then
	Set oSheet = oDoc.ActiveSheet
	oSheet.Activate
	For Each oRevisionTables In oSheet.RevisionTables
		For Each oRevisionTableColumn In oRevisionTables.RevisionTableColumns
		oColumnName = oRevisionTableColumn.Title
		if oColumnName = "Rev" then ' <--- You Can change the column name in here to what ever column you need
			oWidth = InputBox("Enter the width of the Column Name : " + oColumnName + "", "Enter Column Width")
			oRevisionTableColumn.Width = oWidth
		endif
		Next
	Next
Else
	MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Revision Table 	Column Width:"
	Exit Sub
End If
End Sub

If you find this going to help you please accept this as solution.

 

Thanks,

SK

Message 5 of 8

k14348
Advocate
Advocate

Thank you so muchSmiley Happy

 

-karthikeyan M

0 Likes
Message 6 of 8

Anonymous
Not applicable

Hey Guys,

 

this thread is not the newest one, I know, but I have a problem that is pretty much the same described here. I just can't seem to get the width of the RevisionTableColumns changed.

grafik.pngWhen I run exactly your code (just changing the name of the column), this is the error I get. Does anybody have an idea how to fix this? I'm using Inventor 2017.3 (Build 256).

 

Thanks in advance for your help!

Greetings

Thomas

 

 

0 Likes
Message 7 of 8

bradeneuropeArthur
Mentor
Mentor

Did you spell your column Right.

look also for characters (:_-:' etc ) and displayname and name etc.

Maybe the display-name of your column is different from you Column-name

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 8 of 8

Anonymous
Not applicable

Hi bradeneurope, thx for the reply.

If I see it right, the following part of the code prevents me from getting the name wrong:

        If oColumnName = "REV." Then ' <--- You Can change the column name in here to what ever column you need
            oWidth = InputBox("Enter the width of the Column Name : " + oColumnName + "", "Enter Column Width")
            oRevisionTableColumn.Width = CDbl(oWidth)
        End If

Simply because if there is no Column with ColumnName "REV.", then I would never get the prompt for the Width. But I do get that prompt.

grafik.png

And by the way: I'm getting the same error as in my previous post, if I simply try to give one column the width of another column.

    With testtable.RevisionTableColumns
        MsgBox .Item(4).Width
        .Item(1).Width = .Item(4).Width
    End With

This part returns an error and I just don't know why...

0 Likes