我想创建一个Microsoft Word加载项。主要功能是下拉菜单或组合框菜单。 在下拉菜单项中,值包含一个单词。当用户选择项目时,应将其转换为Unicode并显示在工作表中。但是,我要进行特殊操作。
示例: 物品=“阿拉” Unicode = FDF2
当用户选择项目“阿拉”时,它将转换为Unicode“ FDF2”,并自动按alt + x将Unicode更改为伊斯兰图案。
这是我的代码:
Imports Microsoft.Office.Tools.Ribbon
Public Class Ribbon1
Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
AddItemsToDropDown()
End Sub
Private Sub ComboBox1_TextChanged(sender As Object, e As RibbonControlEventArgs) Handles ComboBox1.TextChanged
Label1.Label = Me.ComboBox1.Text
End Sub
Sub AddItemsToDropDown()
Dim itemX As RibbonDropDownItem = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem
Dim itemY As RibbonDropDownItem = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem
Dim itemZ As RibbonDropDownItem = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem
itemX.Label = "Allah"
itemY.Label = "Rasulullah"
itemZ.Label = "Sall Allahu alayhi wa sallam"
Me.ComboBox1.Items.Add(itemX)
Me.ComboBox1.Items.Add(itemY)
Me.ComboBox1.Items.Add(itemZ)
End Sub
End Class