-1
我一直在尝试编码&,如字符& chr(38),但它保留底层的单词。任何解决方案?如何从VBA打印和从Excel到Excel
Private Sub createMenu()
'define the variables
Dim mnuDownload1 As Menu
'create the menue bar
With MenuBars(xlWorksheet)
.Reset
.Menus.Add "Import", 1
'define the menue bar
Set mnuDownload1 = MenuBars(xlWorksheet).Menus("Import")
'for each defined menu bar at the sub item , the first "" is the name of the item. The second "" is the macro name
With mnuDownload1.MenuItems
.AddMenu Caption:="P&S"
.Item("P&S").MenuItems.Add "Exclude P" & Chr(38) & "S", "changes"
End With
End With
End Sub
这是所有的代码是完整的?正如你写的那样,或者用chr(38)会在msgbox中显示“&” – QHarr
你的代码对我来说工作得很好。它显示&只是你想要的。 – braX
对不起,我上面更新 – Lowpar