Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
steveh3
in reply to: steveh3

@WCrihfield 

Thanks again...there was a bug in your code, so I tweaked a bit. Think there was a problem with Dialog box codde.

It runs now, but it even prompts me to update styles even when they are already up to date.

Anyway to get around that?

 

'This logic runs thru all of Drawings Styles and updates them.
Sub Main()
	OpenDoc = ThisDoc.Document
	oStyles = OpenDoc.StylesManager.Styles
	
	'		Pop up message asking if you want to update styles
		oAns = MessageBox.Show("Update to Current Drawing Styles?", "Styles Update", MessageBoxButtons.YesNoCancel,
		MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2)
	
	
	If oAns = DialogResult.Yes Then
		'Runs thru all Styles and update them, if needed
		For Each oStyle As Style In oStyles
			If Not oStyle.UpToDate Then oStyle.UpdateFromGlobal
		Next
	End If
	Try : OpenDoc.Save : Catch : End Try
	'Tells user that Styles have been updated.
	MessageBox.Show("Drawing Styles have been Updated" & vbCr & oFile)
End Sub

  Best,

Steve H.

Steve Hilvers
Inventor Certified User / Vault Professional Influencer