Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
steveh3
533 Views, 12 Replies

Updating idw styles and getting double prompt...would like just one.

Hello All....

Scripting some iLogic to update idw styles.

I have the logic working but just would like one prompt instead of a prompt for every style that is out of date (at least I think that is what is happening).

 

Here's a link to a video...

https://www.screencast.com/t/IkOqZF3HZj

 

Here's the iLogic...

'This logic runs thru all of Drawings Styles and updates them.

Sub Main()
OpenDoc = ThisDoc.Document
oStyles = OpenDoc.StylesManager.Styles

'Runs thru all Styles and see if they are up to date
For Each oStyle As Style In oStyles
	If Not oStyle.UpToDate Then
		
'		Pop up message asking if you want to update styles
		Dim msg As MsgBoxResult = MessageBox.Show("Update to Current Drawing Styles?", "Styles Update", MessageBoxButtons.YesNoCancel,
		MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2)
		
		If msg = vbYes Then
			oStyle.UpdateFromGlobal
		Else
		End If
	End If
Next
Try
	OpenDoc.Save

Catch
End Try

'Tells user that Styles have been updated.
MessageBox.Show("Drawing Styles have been Updated" & vbCr & oFile)

End Sub

 

Thanks in advance!!!!

Steve Hilvers
Inventor Certified User / Vault Professional Influencer