8 Replies Latest reply on Mar 7, 2015 8:05 PM by Rhys Kirk

    What causes this error in my VBA?

    AlistairFrith

      The following code attempts to place a button on top of a label that was created earlier.

       

      ' put a button on top of the label
      Set bgDrillDown = ThisDisplay.Symbols.Add(pbSymbolButton)
      bgDrillDown.SetName (m_name & "_Button")
      bgDrillDown.visible = False
      bgDrillDown.left = label.left
      bgDrillDown.top = label.top
      bgDrillDown.width = label.width
      bgDrillDown.height = label.height
      Set bgDrillDownDef = bgDrillDown.GetDefinition
      bgDrillDownDef.Text = m_DrillDownDisplay
      bgDrillDownDef.Type = pbButLinkedPDI
      bgDrillDownDef.Action = m_DrillDownDisplay
      bgDrillDownDef.Options = pbLinkUseRelativePathFirst
      On Error Resume Next
      bgDrillDown.SetDefinition (bgDrillDownDef)
      If Err.Number <> 0 Then
          MsgBox ("Error creating button for " & m_DrillDownDisplay & " : " & vbCrLf & _
                  "Description: " & Err.Description & vbCrLf & _
                  "Number: " & Err.Number & vbCrLf & _
                  "Source: " & Err.source)
      End If
      On Error GoTo 0

       

      It works fine until it hits the line I have wrapped in 'On Error Resume Next'. At this point I get the error 438 "Object doesn't support this property or method". What is wrong with this? It does not look functionally any different to the example in the Processbook VBA language reference. The m_DrillDownDisplay variable is "Retention.pdi" which is an existing file in the same location as the active display.

       

      I am running ProcessBook 3.1.0.1

       

      --- Alistair.