Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
machiel.veldkamp
200 Views, 1 Reply

Trying to make al text in viewlabels black.

Sub AllBlack()
	Dim LayerCollection As LayersEnumerator = ThisDoc.Document.StylesManager.Layers
	Dim Layer As Layer


	'Loop through LayerCollection
	For Each Layer In LayerCollection
		Dim aColor As Color = Layer.Color
		aColor.Red = 0
		aColor.Green = 0
		aColor.Blue = 0
		Layer.Color = aColor
	Next

	Dim oTextBoxes As TextBoxes
	Dim oDrawingNotes As DrawingNotes
	Dim oViewLabels As DrawingViews
	
	Dim oStyle As TextStyle

	oDoc = ThisDoc.Document
	Dim sht As Sheet
	For Each sht In oDoc.Sheets
		Dim note As DrawingNote
		Dim oView As DrawingView
		Dim oLabel As DrawingViewLabel 
		For Each oView In sht.DrawingViews
			'MessageBox.Show("This is a Label", "Title")
			Dim oColor As Color = oViewLabels.Color
			oColor.Red = 0
			oColor.Green = 0
			oColor.Blue = 0
			Try
				oView.Label.Color = oColor
			Catch
			End Try
		Next
		For Each note In sht.DrawingNotes
			Try
				note.formattedText = note.Replace(note.formattedText, "<StyleOverride Color = '0,0,0'>" & note.formattedText & "</StyleOverride>")
			Catch
			End Try

			Dim oColor As Color = note.Color
			oColor.Red = 0
			oColor.Green = 0
			oColor.Blue = 0
			Try
				note.Color = oColor
			Catch
			End Try
			
		Next
	Next
	
	
	'oTextBox.FormattedText = "<StyleOverride Color = '0,0,0'>" & "</StyleOverride>"
End Sub

I'm trying to loop through all text on the drawing and I'm having some trouble making the text in the drawingview labels black., 

 

Anyone that sees where I'm wrong? 

 

Thanks :slightly_smiling_face: 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________