idw Parts list format collumn heading change via vba

idw Parts list format collumn heading change via vba

k14348
Advocate Advocate
745 Views
2 Replies
Message 1 of 3

idw Parts list format collumn heading change via vba

k14348
Advocate
Advocate

H i need to change the heading of partlist collumn heading via ilogic or vba. Anybody can help?

 

by

karthikeyan M

0 Likes
Accepted solutions (1)
746 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

Hi,

 

The Following code could full fill your requirement.

 

 

Sub Edit_Column_name()

Dim oDoc As Document
Dim oSheet As Sheet
Dim oPartsList As PartsList
Dim oPartsListColumn As PartsListColumn
Dim oColumnName As String
Dim oName As String

Set oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kDrawingDocumentObject Then
    Set oSheet = oDoc.ActiveSheet
    oSheet.Activate
        For Each oPartsList In oSheet.PartsLists
            For Each oPartsListColumn In oPartsList.PartsListColumns
                oColumnName = oPartsListColumn.Title
                oName = InputBox("Enter the new name for the Column :  " + oColumnName + "", "Enter Column Name")
                If oName <> "" Then
                    oPartsListColumn.Title = oName
                End If
            Next
        Next
Else
    MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Column Name"
    Exit Sub
End If
End Sub



 

 If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution

Message 3 of 3

k14348
Advocate
Advocate

Sub Edit_Column_name()

Dim oDoc As Document
Dim oSheet As Sheet
Dim oPartslist As PartsList
Dim oPartsListColumn As PartsListColumn
Dim oColumnName As String
Dim oName As String

Set oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kDrawingDocumentObject Then
Set oSheet = oDoc.ActiveSheet
oSheet.Activate
Set oPartslist = oSheet.PartsLists(1)
For Each oPartsListColumn In oPartslist.PartsListColumns
oColumnName = oPartsListColumn.Title
If oColumnName = "Qty" Then '
oName = "Length"
oPartsListColumn.Title = oName
End If
Next
Else
MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Column Name"
Exit Sub
End If
End Sub

 

Thanks its working 

-karthikeyan M

0 Likes