title: IRibbonUI document load event
body: <p>I'm wondering if someone can help me out with a VBA issue -- I haven't written VBA in over 20 years and I'm stuck.</p>
  
  <p>I've created a ribbon button and I need the button greyed out if a word document is open from a local drive or file share.  I need the button active if the document is open from SharePoint or OneDrive.</p>
  
  <pre><code>Dim Rib As IRibbonUI
  Public MyTag As String
  
  'Callback for customUI.onLoad
  Sub RibbonOnLoad(ribbon As IRibbonUI)
  Set Rib = ribbon
  
  End Sub
  
  Sub GetEnabledMacro(control As IRibbonControl, ByRef Enabled)
  If MyTag = "Enable" Then
      Enabled = True
  Else
      If control.Tag Like MyTag Then
          Enabled = True
      Else
          Enabled = False
      End If
  End If
  End Sub
  
  Sub RefreshRibbon(Tag As String)
  MyTag = Tag
  If Rib Is Nothing Then
      MsgBox "Error, Save/Restart your workbook" &amp; vbNewLine &amp; _
      "Visit this page for a solution:     Else
      Rib.Invalidate
  End If
  End Sub
  
  Sub EnabledAllControls()
  'Enable all controls
  Call RefreshRibbon(Tag:="*")
  End Sub
  
  Sub DisableAllControls()
  'Disable all controls
  Call RefreshRibbon(Tag:="")
  End Sub
  </code></pre>
  
  <p>Then I'm using this if statement to test file location.  It just doesn't fire?</p>
  
  <pre><code>Sub AutoOpen()
  If InStr(ActiveDocument.Path, "http") = 1 Then
  Call EnabledAllControls
  Else
  
  Call DisableAllControls
  
  End If
  End Sub
  </code></pre>
  
  <p>I've been working on this for over a week and I'm under the gun to get it done.</p>