???? Microsoft Office XP ??????? ????? ??? ????
CommandBarButton: ?????
???? ?
????. ???? ??????? ??? ??????? ??? ????? ??? ????? ???? ???? ????? ???? ?? ??????.
?????? ??? ??????? ?????? ????? ?? Microsoft Office 2003.
??? ????? ?????
???? ?
???? ????
IPictureDisp ? ???? ???? ????? ?? ????? Stdole. ??????
IPictureDisp ?????? ?????? ??????? ??????? ??? ???? ???????. ????? ?????
???? ?
???? ???? ??????? ??? ??? ??????? (????? ????? VBA ??????? ??????? ???????? ? ActiveX DLLs ????? ?? ???????). ???? ??? "???????" ?????? ??? ???? ?? ????????? ???????? ??? ??????.
???? ????? ????? ????? ????? ??????? ??????? ???????? ???? ???? ?? CommandBar ?? ???? ????.
??????? ??????? ?????? ??? ?????? ? ?? ????
- ??? ????? "??????". ?? ??????? ????? ???? ??? ??????. ????? ??? ?????? ??? 32 × 32 ?? ???? ??? ?????.
- ??? ??? ???? ??? ?????. ????? ??????? ??? ??????? ?????? ??????.
?? ??? ??????????? ??? ??????
- ??? ?????? Circle.bmp.
- ?????? ?????? ????? ??????? ??????? ?? ????? ??????? ???? ??????? ???????. ??? ????? ?????? ?? ?????? ??? ???? ???? CommandBar ????? ????? ????? ?????? ????? ???? ????? ???? ????.
?? ??? ??????????? ??? ??????
- ??? ?????? Mask.bmp.
??????? ??????? ?????? AddIn COM
- ??? ????? Visual Basic AddIn ????? ?????? ???????.
- ?? ??????? ??????? ???? "?????". ??? ????? ??? "Microsoft Office" ???? ?? ??????? ??? ????? XP ? ?? ?????? ????? ???? ???? ????? ???? ????? ??????? ?? Microsoft Office XP. ???? ??? ?????.
- ?? "?????? ?????????" ???? ??? ?????? ?????? ??? frmAddin ??? ?? ???? ??? ????? frmAddin.
- ?? "?????? ?????????" ???? ????? ??????? ??? ???? ???????. ?????? ??? Microsoft Excel ?? ??? ???? ??????? ?????? ?? ??? ???????.
- ?? ??????? ???? ???? ??? ????? ?? ?????? ????????? ???????? ?? ????? - ?? ?? ???:
Option Explicit
Dim oExcel As Object
Dim WithEvents oButton As Office.CommandBarButton
Private Sub AddinInstance_OnConnection(ByVal Application As Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)
Dim oPic As stdole.IPictureDisp
Dim oMask As stdole.IPictureDisp
' Load the picture and mask.
Set oPic = LoadPicture(App.Path & "\circle.bmp")
Set oMask = LoadPicture(App.Path & "\mask.bmp")
' Save an instance of our application.
Set oExcel = Application
' Create a new button on the standard CommandBar.
Set oButton = oExcel.CommandBars("Standard").Controls.Add(msoControlButton)
With oButton
' Set a tag for the button.
.Tag = "My Button"
' Set the event to fire when the button is pressed.
.OnAction = "!<" & AddInInst.ProgId & ">"
' Set the picture property -- if you are using the Mask property, this
' property must be set before you set the Mask property.
.Picture = oPic
' Set the Mask property.
.Mask = oMask
' Show the button.
.Visible = True
End With
End Sub
Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As _
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
' Delete the button.
oButton.Delete
' Release references.
Set oButton = Nothing
Set oExcel = Nothing
End Sub
Private Sub oButton_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
' Our button was pressed.
MsgBox "The button was pressed!"
End Sub
- ??? ??????? ?? ????? ??????? ???????? ?? ???? ????? ??????? ??? ???????.
- ??? ????? Excel. ???? ???? ???? ???? ?? ????? ????? ????? ??? CommandBar ????????. ???? ?? ??????? ??? ????? ????? ?????.
??????? ????????? ??? ??????? ???? ?????? ??????? ??????? ?????
IPictureDisp ??? ???? ???????. ????? ????? ????? ???? ????? ?????
????? ?????????
???? ?? ????? ??????:
??? ??? ??????? '-2147418113(8000ffff) ':
??? ??????? '????' ?????? '_CommandBarButton'
????? ?? ????? ????? ??? ??????? ??????
CommandBarButton ?? ?? ???? ??????? ???? ??????? ?? ?? ???? ?? ????? ??? ??????? ?? ??? ??????? ?? IDE Visual Basic. ?? ???? ????? ?????? ??????? ???????? ???????? ?? ??? ?????? ?? IDE Visual Basic ?????? ??? ?????. ????? ????? ????? ????? ????? ??????? ?????? ???? ??????
???? ?
???? ?? ??????? ??????? ??????? ???
#If... ??... #Else ???????.
?????? ??? ??????? ??????? ???? ??? ????? ???????? ??????? ?????? ?? "????? ??????? ?? Microsoft:
238228
(http://support.microsoft.com/kb/238228/
)
????? ????? Office 2000 COM ??????? ???????? ?? Visual Basic
230689
(http://support.microsoft.com/kb/230689/
)
?????: Comaddin.exe Office 2000 COM ??????? ???????? ???????? ?? Visual C++
150034
(http://support.microsoft.com/kb/150034/
)
PRB: LPPICTUREDISP ?? ???? ????? ??? ?????? ??????
????? ?? ?????????? ???? ???? Microsoft ?????? ??? ?????:
???? ???????: 286460 - ????? ??? ??????: 10/????/1428 - ??????: 4.6
????? ???
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic 6.0 Professional Edition
- Microsoft Office Access 2003
- Microsoft Access 2002 Standard Edition
- Microsoft Office Excel 2003
- Microsoft Excel 2002 Standard Edition
- Microsoft Office Word 2003
- Microsoft Word 2002 Standard Edition
- Microsoft Office FrontPage 2003
- Microsoft FrontPage 2002 Standard Edition
- Microsoft Office Outlook 2003
- Microsoft Outlook 2002 Standard Edition
- Microsoft Office PowerPoint 2003
- Microsoft PowerPoint 2002 Standard Edition
| kbmt kbautomation kbhowto KB286460 KbMtar |
????? ???????: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????
286460
(http://support.microsoft.com/kb/286460/en-us/
)