title: Uipath error: "macro may not be available in this workbook"?
body: <p>I am trying to retrieve cell addresses from an Excel sheet with UIPath invoke VBA activity.</p>
  
  <p>I am new to VBA coding. I have written a function to retrieve cell address array and I have written a sub procedure to call that function.</p>
  
  <p>I am calling the sub in UIPath activity named 'invoke VBA'. When I run this it says </p>
  
  <blockquote>
    <p>Invoke VBA : Cannot run the macro 'Main'. The macro may not be<br>
    available in this workbook or all macros may be disabled.</p>
  </blockquote>
  
  <p>This is the screen shot where I have enabled macros in Excel:
  <img src="https://i.stack.imgur.com/5205P.png" alt="screen shot"></p>
  
  <pre><code>Sub Main(Amount As Integer)
      Call findcellFunction(Amount)
  End Sub
  
  Function findcellFunction(Amount As Integer)As Collection
      On Error Resume Next
      Dim rngX As Range           
      Dim WS As Worksheet
      Dim datax As Range
      Dim cellAddress As Variant
      Dim index As Integer
      Dim iTotal As Integer
      Dim CellArray 
      iTotal = 0
      Set CellArray = New Collection
      'Iterate until all cell values are found
      For index=1 To Amount
          Set rngX = Worksheets("rptBOMColorPrint").Range("A1:EZ50").Find("Colour Name", lookat:=xlPart)
          If Not rngX Is Nothing Then
              MsgBox "Found at " &amp; rngX.Address
              CellArray.Add rngX.Address
          End If
          Cells(rngX.Row,rngX.Column).Delete
          iTotel =iTotal + index
      Next index
      'shows list that has been populated with cell addresses
      For Each cellAddress In CellArray
          MsgBox "list populated " &amp; cellAddress
          Range(cellAddress).Value = "Colour Name"
      Next
      CellArray = findcellFunction(Amount)
  End Function
  </code></pre>
  
  <p>This is how I call the VBA from the UIPath activity.
  <img src="https://i.stack.imgur.com/0I388.png" alt="How I call the VBA macro from UIPath"></p>