Sheet.name isn't updating - what am I doing wrong?

Sheet.name isn't updating - what am I doing wrong?

Anonymous
Not applicable
438 Views
3 Replies
Message 1 of 4

Sheet.name isn't updating - what am I doing wrong?

Anonymous
Not applicable

I am trying rename each of my sheets.  What am I doing wrong?

Sub Main()
    oDrawDoc = ThisApplication.ActiveDocument
    For Each oSheet In oDrawDoc.Sheets
        ModSheetName(oSheet)
    Next
End Sub

Sub ModSheetName(oSheet As Inventor.Sheet)
	Dim SheetName As String = oSheet.Name 
	
	sTemp = InputBox("New Sheet Name", SheetName, SheetName)

'Message box to see that I get the new value i = MessageBox.Show(sTemp, "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) oSheet.Name = UCase(sTemp)
'Message to to see if the new value was accepted i = MessageBox.Show(oSheet.Name, "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) oSheet.Parent.Update End Sub

Also, is the update needed?

 

Thanks in advance.

Mike

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

clutsa
Collaborator
Collaborator
Accepted solution

Have you tried restarting inventor? I literally copy and pasted your code into a rule and it worked just fine. Are you getting an error message?

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 3 of 4

philip1009
Advisor
Advisor

It does work as posted and it does update the Sheet Names in the Browser, are you trying to update or change something else?

0 Likes
Message 4 of 4

Anonymous
Not applicable

Reboot solved the problem.

 

Thanks.

0 Likes