title: Application.MacroOptions and Error 1004
body: <p>I want to register a function kind of <code>CalculateHours(work_hour, rest_hour)</code> to Excel VBA, in an Addin like Works.xla</p>
  
  <p>I tried using <code>Application.MacroOptions</code> to register the function. The following code is in a <code>Class</code> file, the function is in another module file. They would load when we open Excel and the Addin.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>Private Function AddFunctions()    
      With MyFunction       
          Application.MacroOptions .Name, _
              .Description, , , , , .Category, , , .HelpFilePath                
      End With    
  End Function
  </code></pre>
  
  <p><strong>Expectation:</strong></p>
  
  <p>I wanna get the argument help, function description in Excel function wizard as other built-in functions. With the help button link to my help file.</p>
  
  <p><strong>Result:</strong></p>
  
  <pre><code>Error number: 1004 Application-defined or object-defined error
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Method "MacroOptions" of object "_Application" failed
  </code></pre>
  
  <p>Is there anything (or everything) wrong?</p>
  
  <p>I have kind of 10 functions and need to add them automatically to Excel function wizard every time load the Addin.</p>