[英]How can i use picture as icon in shortcut menu vba access?
I tried this我试过这个
Set cbCat = CommandBars.Add(conBarName, msoBarPopup, False, False)
Set cbCatCtrl = cbCat.Controls.Add(msocontrolpopup)
cbCatCtrl.Caption = "Open Form"
Do While Not rsForms.EOF
Set cbObjectCtrl = cbCatCtrl.Controls.Add()
With cbObjectCtrl
.Caption = rsForms!Name
.Tag = rsForms!Name
.OnAction = "OpenForm"
' .Picture = stdole.StdFunctions.LoadPicture("D:\1.bmp")
But it doesn't work, Error Invalid Picture, I tried.ICO Icons but still the same.但是不行,Error Invalid Picture,我试过了。ICO Icons 但还是一样。 How can I load a picture from my pc and use it as icon instead of faceID method?
如何从我的电脑加载图片并将其用作图标而不是 faceID 方法? Thanks in Advance
提前致谢
Hy,嗨,
I got this from: Docs.Microsoft我从: Docs.Microsoft得到这个
It looks like you need to create a IPictureDisp first and then link this to the relevant control.看起来您需要先创建一个 IPictureDisp,然后将其链接到相关控件。 Also try using a.bmp
也尝试使用 a.bmp
Sub ChangeButtonImage()
Dim picPicture As IPictureDisp
Set picPicture = stdole.StdFunctions.LoadPicture( _
"c:\images\picture.bmp")
'Here you need to reference your control.
With Application.CommandBars.FindControl(msoControlButton)
'Change the button image.
.Picture = picPicture
End With
End Sub
Looking forward to your solution...期待您的解决方案...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.