ช่วยอธิบาย Code คำสั่ง ให้หน่อยครับ
Posted: Mon Jul 09, 2012 2:37 pm
รบกวนอาจารย์ครับ พอดีไปหาวิธีการใช้งานใน Help ใน VBA Excel มาครับ
อาจารย์อธิบาย คำสั่งเหล่านี้ให้ฟังหน่อยครับ
เป็นการใส่รูปลงใน commandbutton ใช่รึเปล่าครับ
และ
ผมก็อปปี้มาทั้งโค้ดเลยครับ รบกวนอาจารย์หน่อยนะครับ
อาจารย์อธิบาย คำสั่งเหล่านี้ให้ฟังหน่อยครับ
เป็นการใส่รูปลงใน commandbutton ใช่รึเปล่าครับ
Code: Select all
Sub ChangeButtonImage()
Dim picPicture As IPictureDisp
Dim picMask As IPictureDisp
Set picPicture = stdole.StdFunctions.LoadPicture( _
"c:\images\picture.bmp")
Set picMask = stdole.StdFunctions.LoadPicture( _
"c:\images\mask.bmp")
'Reference the first button on the first command bar
'using a With...End With block.
With Application.CommandBars.FindControl(msoControlButton)
'Change the button image.
.Picture = picPicture
'Use the second image to define the area of the
'button that should be transparent.
.Mask = picMask
End With
End Sub
Code: Select all
Sub GetButtonImageAndMask()
Dim picPicture As IPictureDisp
Dim picMask As IPictureDisp
With Application.CommandBars.FindControl(msoControlButton)
'Get the button image and mask of this CommandBarButton object.
Set picPicture = .Picture
Set picMask = .Mask
End With
'Save the button image and mask in a folder.
stdole.SavePicture picPicture, "c:\image.bmp"
stdole.SavePicture picMask, "c:\mask.bmp"
End Sub