6 Replies Latest reply on Jun 10, 2016 1:47 AM by Kenji Hashimoto

    Convert Label (string) to Integer in ProcessBook using VBA

    Mikeconnors

      Hi All,

       

      I'm currently trying to multi-state a label in a userform so that when it reaches a certain value it flashes. The trouble I'm having is converting the label to an integer. this is what I have so far and it doesn't work

      the rest of the code works fine its just the converting that keeps giving me the error

       

      Private Sub FlashLabel()
      
      Dim CompressionRatio As Integer
      CompressionRatio = CInt(LabelForeColor.Caption)
      
          Do While Flash = True
         
              If   Me.LabelCompRat.ForeColor = vbBlack And CompressionRatio > 30 Then
                   Me.LabelCompRat.ForeColor = vbRed
                 
             Else
                   Me.LabelCompRat.ForeColor = vbBlack
                        
              End If
              Sleep (100)
              DoEvents
                    
          Loop
      End Sub
      

       

      Thanks,

      Michael