????? ????? ???? ???????? ???? Office XP CommandBars

?????? ????????? ?????? ?????????
???? ???????: 286460 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? Microsoft Office XP ??????? ????? ??? ???? CommandBarButton: ????? ???? ? ????. ???? ??????? ??? ??????? ??? ????? ??? ????? ???? ???? ????? ???? ?? ??????.

?????? ??? ??????? ?????? ????? ?? Microsoft Office 2003.

??????? ????

??? ????? ????? ???? ? ???? ???? IPictureDisp ? ???? ???? ????? ?? ????? Stdole. ?????? IPictureDisp ?????? ?????? ??????? ??????? ??? ???? ???????. ????? ????? ???? ? ???? ???? ??????? ??? ??? ??????? (????? ????? VBA ??????? ??????? ???????? ? ActiveX DLLs ????? ?? ???????). ???? ??? "???????" ?????? ??? ???? ?? ????????? ???????? ??? ??????.

???? ????? ????? ????? ????? ??????? ??????? ???????? ???? ???? ?? CommandBar ?? ???? ????.

??????? ??????? ?????? ??? ?????? ? ?? ????

  1. ??? ????? "??????". ?? ??????? ????? ???? ??? ??????. ????? ??? ?????? ??? 32 × 32 ?? ???? ??? ?????.
  2. ??? ??? ???? ??? ?????. ????? ??????? ??? ??????? ?????? ??????.

    ?? ??? ??????????? ??? ??????
    Picture of sample Picture.bmp. Steps
				to re-create this image are given in this article.
  3. ??? ?????? Circle.bmp.
  4. ?????? ?????? ????? ??????? ??????? ?? ????? ??????? ???? ??????? ???????. ??? ????? ?????? ?? ?????? ??? ???? ???? CommandBar ????? ????? ????? ?????? ????? ???? ????? ???? ????.

    ?? ??? ??????????? ??? ??????
    Picture of sample Mask.bmp. Steps to
				re-create this image are given in this article.
  5. ??? ?????? Mask.bmp.

??????? ??????? ?????? AddIn COM


  1. ??? ????? Visual Basic AddIn ????? ?????? ???????.
  2. ?? ??????? ??????? ???? "?????". ??? ????? ??? "Microsoft Office" ???? ?? ??????? ??? ????? XP ? ?? ?????? ????? ???? ???? ????? ???? ????? ??????? ?? Microsoft Office XP. ???? ??? ?????.
  3. ?? "?????? ?????????" ???? ??? ?????? ?????? ??? frmAddin ??? ?? ???? ??? ????? frmAddin.
  4. ?? "?????? ?????????" ???? ????? ??????? ??? ???? ???????. ?????? ??? Microsoft Excel ?? ??? ???? ??????? ?????? ?? ??? ???????.
  5. ?? ??????? ???? ???? ??? ????? ?? ?????? ????????? ???????? ?? ????? - ?? ?? ???:
    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
    					
  6. ??? ??????? ?? ????? ??????? ???????? ?? ???? ????? ??????? ??? ???????.
  7. ??? ????? Excel. ???? ???? ???? ???? ?? ????? ????? ????? ??? CommandBar ????????. ???? ?? ??????? ??? ????? ????? ?????.

??????? ??????

??? ??? ??????? ???? ?????? ??????? ??????? ????? IPictureDisp ??? ???? ???????. ????? ????? ????? ???? ????? ????? ????? ????????? ???? ?? ????? ??????:
??? ??? ??????? '-2147418113(8000ffff) ':
??? ??????? '????' ?????? '_CommandBarButton'
????? ?? ????? ????? ??? ??????? ?????? CommandBarButton ?? ?? ???? ??????? ???? ??????? ?? ?? ???? ?? ????? ??? ??????? ?? ??? ??????? ?? IDE Visual Basic. ?? ???? ????? ?????? ??????? ???????? ???????? ?? ??? ?????? ?? IDE Visual Basic ?????? ??? ?????. ????? ????? ????? ????? ????? ??????? ?????? ???? ?????? ???? ? ???? ?? ??????? ??????? ??????? ??? #If... ??... #Else ???????.

?????

?????? ??? ??????? ??????? ???? ??? ????? ???????? ??????? ?????? ?? "????? ??????? ?? Microsoft:
238228????? ????? Office 2000 COM ??????? ???????? ?? Visual Basic
230689?????: Comaddin.exe Office 2000 COM ??????? ???????? ???????? ?? Visual C++
150034PRB: LPPICTUREDISP ?? ???? ????? ??? ?????? ??????
????? ?? ?????????? ???? ???? Microsoft ?????? ??? ?????:
http://support.microsoft.com/ofd

???????

???? ???????: 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

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com