Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net ExcelDna未在加载项中显示自定义功能区_Vb.net_Visual Studio 2017_Excel 2013_Excel Dna - Fatal编程技术网

Vb.net ExcelDna未在加载项中显示自定义功能区

Vb.net ExcelDna未在加载项中显示自定义功能区,vb.net,visual-studio-2017,excel-2013,excel-dna,Vb.net,Visual Studio 2017,Excel 2013,Excel Dna,我正在将一个旧的dna文件转换为visual basic.net,以便在Excel 64位中使用 功能区用于在32位版本(用于更改默认值的简单msgbox)中显示,但功能区未在新版本中显示 我正在使用VS2017 用于创建功能区的代码: ' Can make a class that implements ExcelDna.Integration.CustomUI.ExcelRibbon ' to get full Ribbon access. Public Class MyRibbon

我正在将一个旧的dna文件转换为visual basic.net,以便在Excel 64位中使用

功能区用于在32位版本(用于更改默认值的简单msgbox)中显示,但功能区未在新版本中显示

我正在使用VS2017

用于创建功能区的代码:

' Can make a class that implements ExcelDna.Integration.CustomUI.ExcelRibbon
' to get full Ribbon access.
Public Class MyRibbon
    Inherits ExcelRibbon

    Public Sub OnButtonPressed(control As IRibbonControl)
        SetDefault()
    End Sub

End Class
功能区的dna文件中的代码:

<CustomUI>
   <!-- Inside here is the RibbonX xml passed to Excel -->
   <customUI xmlns = "http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon>
      <tabs>
        <tab idMso = "TabAddIns" >
          <group idQ="x:ORSErlang64" label="ORSErlang64">
            <button id="C1" label="Set Default" size="large"
            imageMso="StartAfterPrevious" onAction="OnButtonPressed"/>

          </group>
        </tab>
      </tabs>
    </ribbon>
  </customUI>
</CustomUI>


我不知道我做错了什么,我在web上找到的大多数示例都是c#,而不是vb.net

问题是您将组的ID声明为
idQ=“x:ORSErlang64”
,但您没有声明名称空间
x
是什么

customUI
元素上,您需要定义
x
名称空间,例如

例如:

<DnaLibrary RuntimeVersion="v4.0" Name="Ribbon Tests" Description="Ribbon Tests Description (not used)">
   <![CDATA[
     Imports System.Runtime.InteropServices
     Imports Microsoft.Office.Core
     Imports ExcelDna.Integration.CustomUI

     <ComVisible(True)> _
     Public Class MyRibbon
       Inherits ExcelRibbon

       Public Sub  OnButtonPressed(control as IRibbonControl)
           MsgBox("My Button Pressed on control " & control.Id,, "ExcelDna Ribbon!")
       End Sub

     End Class
   ]]>

  <CustomUI>
     <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
               xmlns:x="http://caioproiete.net">
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group idQ="x:ORSErlang64" label="ORSErlang64">
              <button id="C1" label="Set Default" size="large"
                imageMso="StartAfterPrevious" onAction="OnButtonPressed" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
  </CustomUI>

</DnaLibrary>

_
公共级米里布
继承ExcelRibbon
按下公共子按钮(控件为IRIBONCONTROL)
MsgBox(“控件上按下的我的按钮”&control.Id,,“ExcelDna Ribbon!”)
端接头
末级
]]>

问题是您将组的ID声明为
idQ=“x:ORSErlang64”
,但您没有声明名称空间
x
是什么

customUI
元素上,您需要定义
x
名称空间,例如

例如:

<DnaLibrary RuntimeVersion="v4.0" Name="Ribbon Tests" Description="Ribbon Tests Description (not used)">
   <![CDATA[
     Imports System.Runtime.InteropServices
     Imports Microsoft.Office.Core
     Imports ExcelDna.Integration.CustomUI

     <ComVisible(True)> _
     Public Class MyRibbon
       Inherits ExcelRibbon

       Public Sub  OnButtonPressed(control as IRibbonControl)
           MsgBox("My Button Pressed on control " & control.Id,, "ExcelDna Ribbon!")
       End Sub

     End Class
   ]]>

  <CustomUI>
     <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
               xmlns:x="http://caioproiete.net">
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group idQ="x:ORSErlang64" label="ORSErlang64">
              <button id="C1" label="Set Default" size="large"
                imageMso="StartAfterPrevious" onAction="OnButtonPressed" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
  </CustomUI>

</DnaLibrary>

_
公共级米里布
继承ExcelRibbon
按下公共子按钮(控件为IRIBONCONTROL)
MsgBox(“控件上按下的我的按钮”&control.Id,,“ExcelDna Ribbon!”)
端接头
末级
]]>