title: Problem with EXCEL MacroOptions method to assign help file to UDF
body: <p>In Excel, it is possible to assign help file (e.g. chm file) to a user-defined function using VBA code, Application.MacroOptions method. So, I faced a strange issue with it.</p>
  <p>Suppose that we wrote the UDF named as &quot;myUDF()&quot;.</p>
  <pre><code>Function myUDF()
  myUDF = &quot;it is test&quot;
  End Function
  </code></pre>
  <p>When you open Function Wizard for it, and click on &quot;Help on this function&quot;, Excel get error : &quot;No help available.&quot;</p>
  <p>So, we run below code to assign help file to it:</p>
  <pre><code>Sub SetHelpFile()
          Application.MacroOptions _
              Macro:=&quot;'&quot; &amp; ThisWorkbook.Name &amp; &quot;'!&quot; &amp; &quot;myUDF&quot;, _
              HelpFile:=ThisWorkbook.Path &amp; &quot;\CHM-example.chm&quot;, _
              HelpContextID:=10010
  End Sub
  </code></pre>
  <p>It is necessary that chm file contains Topic ID. I used chm file from this <a href="http://www.help-info.de/files_download/CHM_VBA_example/CHM_VBA_example.zip" rel="nofollow noreferrer">sample</a>.
  After running the code, chm file is assigned to UDF. But there is a problem. If you click on &quot;Help on this function&quot;, it can't show specific page according mentioned topic ID (for this sample: 10010)</p>
  <p>It is more complicate If you run code SetHelpFile again. After that If you click on &quot;Help on this function&quot;, it show correct page.</p>
  <p>I don't know what's the problem. Is it a bug?</p>
  <p><strong>EDIT</strong>:
  To reproduce the issue, you can get <a href="https://files.fanra.ir/Test_UDF_help.rar" rel="nofollow noreferrer">this file</a> and test it!</p>