????? ????? Office COM ??????? ???????? ???????? VBA ? Office ??????

?????? ????????? ?????? ?????????
???? ???????: 306130 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ??? UserForm welcomes ??? ??? ????? Microsoft Excel ?? Microsoft Word. ???? ???? Object Model (COM) ???????? ???????? ????? ?????? sign ????? ????????? ???????? ??????? ?? ????? ???????? ?????????? ??????? ??????? (DLL) ??? ????? ?????? ?? ?? Office ??????? (??? ???? ??????? ????? ?????? ??? ???? ????? Microsoft Outlook ?? Microsoft Access Word ?Excel). ????? ???? ????? ??? ??? ????? DLL COM ?? Microsoft Office ?? ????? ?? ??????? ???????? ????? ???? ???? ???? ?????? ??? ??????? IDTExtensibility2.

???????

????? ??? ??????? ??? ??????? ??? ???????? ???????:

  • ????? Visual Basic ?????? ??? ??????? Applications (VBA) ?? ????? Office XP.
  • ????? ?? UserForms ?? VBA.
  • ????? ????? ??????? Office XP.

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

????? ????? ????? ??????? ???????? ?? ?? ????? Microsoft Office 2000 ?? Microsoft Office XP ????? ???? ???? Microsoft Office 2000 ?????? ?? ????? ????? Microsoft Office XP ??????. ?????? ??? ?????? Microsoft Word 2002.
  1. ??? ????? Microsoft Word 2002.
  2. ?? ??????? ????? ? ??? ??? ????? ? ?? ???? ??? ???? Visual Basic.
  3. ?? Visual Basic ???? (VBE) ? ???? ??? ????? ???? ?? ??????? ???.
  4. ?? ???? ?????? ????? ???? ? ???? ??? ????? ??????? ????????. ???? ??? ???????? "????" ??????? ????????.
  5. ?? ???? ??? ???? ?????? "?????" ? ???? ??? ???? ????? ?? ??????? ???.
  6. ?? ?????? "?????" ????? ????? ??????? ?? AddInDesigner1 ??? WelcomeAddIn.
  7. ?? ??????? ????? ? ???? ??? UserForm ?????? UserForm.
  8. ?? ???? ??????? ? ????? ????? ?? ??? ??? UserForm.
  9. ?? ?????? "?????" ? ???? ???? ????? ?????? ??????? ????? ???? ?? ?????? ??????:
    ?? ??? ??????????? ??? ??????
    ???? ???????????????
    ????????lblMessage
    ??????? ??????????????? ??
    ????14pt
    AutoSize????
    CommandButton???cmdOK
    ??????? ??????????????
    UserForm???frmWelcome

  10. ?? ??????? ????? ? ???? ??? ?????? ??????? ?????? ?????? ????? ??????.
  11. ????? ????? ????? ????? ???????? ??????? ??? ???? ????? ??????:
    Public gstrUserName As String
    'This variable will be used to store the name of the user as defined
    'in the Options dialog boxes (from the Tools menu) in Word and Excel.
    					
  12. ?? ?????? ??????? ? ?? ?????? ????????? ???????? ??????? ?????? ????? Sub ??? ?????? DisplayForm ???? ??????? ??? ??????:
    Public Sub DisplayForm()
      frmWelcome.Show vbModal
    End Sub
    					
  13. ??? ???? ????????? ???????? ??????? frmWelcome ???????? ???????? ???????? ??????? ??? ????? UserForm_Initialize ???????? ??????? ????????? ??????? ?? ????? ?????:
    lblMessage.Caption = lblMessage.Caption & " " & gstrUserName
    					
  14. ?? ?????? ????????? ???????? ??????? ??? ??? "?????" CommandButton cmdOK ????? ????? ???????:
    Unload me
    					

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

???? ??????? ??????? ?????? ????? ?????? ???? ??????? ???????? ???? ????? ??? ????? Microsoft Excel:
  1. ?? "?????? ?????????" ???? ????? ??????? ??? ?????? ?????? ??? "????" ??????? ????????.
  2. ?? ????? ??????? ??? ?????? ????? ????? ?????? ??????? ????? ???? ?? ?????? ??????:
    ?? ??? ??????????? ??? ??????
    ???????????
    ??? ????? addInFunFormMessage
    ??? addIn????? ??? ??? ????????? ???????? ?????? ?? Excel
    ???????Microsoft Excel
    ????? ???????Microsoft Excel 10.0
    ???? ??????? ????????? ???????

????? ??????? IDTExtensibility2

  1. ?? ??????? ???? ???? ??? ????? ???? ?????? ??????? ????????? ???????? ??? ??????.
  2. ?? ??????? ?????? ???? ??? ????? ?? ?? ?????? ???? ??? ???? Microsoft Excel ?????.
  3. ?? ??????? ???????? ???? ???? ??? AddinInstance. ?? ??????? ???????? ????? ???? ??? OnConnection.

    ???? ??? ????? ?????? ?? CommandBar ?? ???? ????????? ???????? ?? ??? ??? ??? ????? ??? ??????? ???????? ???? ??? ??????? ??????.
  4. ?? ?????? ????????? ???????? ??????? ??? ????? ????? AddinInstance_OnConnection ????? ??? ???????? ?? ????? ????? strUserName ?? ??????? ??????? DisplayForm:
    gstrUserName = Application.UserName
    DisplayForm
    					
  5. ?? VBE ? ???? ??? ??? ?? ??? ??????? Welcome.vba.

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

?? ??? ??????? ?????? ???? ???? ?????? ??? ??????? ?? Microsoft Word.
  1. ????? "?????" ??? ??????? ???????? ?? VBE. ??? ????? AddInProject2 ???? ???????.
  2. ?? "?????? ?????????" ???? ????? ???? - ?? ???? ??????? (AddInDesigner1) ?? ??????? ??????? ???????? ????????. ????? ???? ????? ????? ?? ???????.
  3. ?? "?????? ?????????" ???? ??? ?????? ?????? ??? AddInProject2 ??? ?? ???? ??? ????? Project ??? ????? ????? ???? ??? ????????.
  4. ??? ???? ??????? ??????? ?? ??????
    ?? ????? AddInProject2 ???????. ?? ???? ?? ????
    ???? ??? "??".
  5. ????? ????? ???? ?????? 10 Word ?????? ????? ?? ????? ??? ??? ???????.
  6. ?? ?????? ????????? ???????? ??????? ??? ???? Word ???? AddinInstance_OnConnection ????? ???, ????? ?? ??? ??? ?????? ?????? ???? OnConnection ???? Excel:
    gstrUserName = Application.UserName
    DisplayForm
    					

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

  1. ??? ??? ???? ????? ???? ???? ???????? ??? ????????? ????????.
  2. ?? VBE ? ???? ??? ????? Project ?? ??????? "?????" ?????? ??????? ????????.
  3. ??? ????? Microsoft Excel. ??? ??? ????? "???????" ? ???? ????? ???? ???? ?? ???? AddIn. ???? ??? ?????? ??? ????? ????? ??????? ??? Excel.exe. ??? ?? ???? ???? ?????? ???, ???? ??? ???? ? ???? ??? ??????? ?? ???? ??? Microsoft Excel ??? ????? Excel. ??? ?? ???? UserForm ????? ??.
  4. ??? ?? ??? "?????" ??????? ???????? COM ???????? ??????? ?? ?????? ????? ????? COM ???????? "??? ???? ????? ??? ???:
    1. ?? ??????? ?????? ???? ??? ?????.
    2. ?? ???? ?????? ????? ? ??? ????? ??????? ??????? ???? ????? ????? COM ???????? ?? ??? ????? ??? ??? ????? ????? ?? ??? ???? CommandBarPopup ??????? ?????.
  5. ???? ??? ???? ????? ????? COM ???????? ???? ?? COM ??????? ???????? ????? (CAM). ???? ??????? ?? CAM ???? ??????? ???????? ???? ?? ???????.
  6. ??????? ????? OnConnection ???? ??????? ??????? ???????? ???? ???????? ?? CAM ?? ???? ??? ?????. ?????? ??? CAM ??? ???? ???????? ??????? ??? ?? ???? ??? ?????. ??? ?? ???? UserForm ??? ????.
  7. ???? ??????? ?????? (Word ?? Excel) ?? ???? ??? ????? ??????? ?? ??????? "?????" ?? VBE ?????? ????? ???????.

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

???? ????? ????? ??????? ???????? ?? ???? ?? ??? ???? ??? ??????? ???.
  1. ??? ??????? ?? VBE. ??? ?? ????? ???? ???????. ?? ???? ???? ????? ????? ????? ???????.
  2. ?? ??????? ???? ???? ??? ???? Welcome.DLL.
  3. ?????? ????? regsvr32 ????? DLL ??? ???:
    1. ?? ??????? "????" ? ???? ??? ?????.
    2. ?? ???? ???? ??? ? ???? ???? ??????:
      regsvr32 <???? > \Welcome.DLL
      ??? <???? > ?? ???? ???? ??? DLL.
  4. ???? ??? ????? ?????? ????? DLL.
  5. ????? Excel ?/?? Word. ??? ?? ???? UserForm ????? ??. ??? ?? ????? ????? ?? UserForm ???? ??? ??????? ???????? COM ?? ??????? "?????" ???? ???? ???????? ???????.
??????: ???? ????? ?????? DLL ?? ??????? "????" ? "????? ?????.

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

  • ???? ?? ????? ??? ?????, ?????? ????? ??????? ???????? ??? ????? ??? ???????. ??? ???? ??????? ??? ??? OnConnection ????? ?????? ????? ???????? ??? ??? ??????? ? ???? ?????? ?????????? ?? ???? ????????? ?? ????????? (????? ???).
  • ?? ????? ??? ??????? UserForms. ?? ???? ???? ???????? ?????? ??? ??????? ?????? ?? ????? ???????? ?? ???? ??? ??????? ???? ??? ?????? ??? ??????? ??????. ????? ?? ???? ???? ??????? ????? ?????? ??? ??? ???????. ???? ????? ????? ?????? ?????? vbModal ??? ???:
    frmMyUserForm.Show vbModal
    						
    ?????? ??? ?????? ??? ???????? ???????? ?? ???? ??? ??? ?????? ???? ????????? ???????? ?? ?????? 12 ?? ?????? Create an Add-In Project.

?????

???? ??? \Samples\Working ?? AddIns\VBA_COM_AddIn ?????? ??? ????? ??????? ?????? XP Office ????? AddIn.

?????? ??? ??????? ?????? ??? ????? ????? CommandBar ?? ?????? ???? ???? ????? Microsoft (MSDN) ?????? ??? ?????:
http://msdn.microsoft.com/en-us/library/aa140930.aspx

???????

???? ???????: 306130 - ????? ??? ??????: 26/????? ??????/1425 - ??????: 4.5
????? ???
  • Microsoft Office XP Developer Edition
  • Microsoft Office XP Professional
????? ??????: 
kbmt kbhowtomaster KB306130 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????306130

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

 

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