????? ??????? ????? ?????? ??? ????? ????? ????? Office ???????? Visual Basic .NET

?????? ????????? ?????? ?????????
???? ???????: 303294 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

??????

???? ??? ?????? ????? ????? Microsoft Word ?? Microsoft Visual Basic .NET ???????? ? ??????? ?? ????? ???????. ??? ????? ?? ?? ??? ????? ??????? ?? ??? ??????? ???? ??? ?????? Word, ??? ????? ??? ???????? ??? Microsoft Excel ? Microsoft PowerPoint.

??????? ????

????? ??? ????? ??????? ?????? ?? Microsoft Word

  1. ??? ????? Visual Studio .NET.
  2. ?? ??????? ???? ???? ??? ???? ?? ???? ??? ???????. ??? ????? Windows ?? ????? ????? Visual Basic. ??? ????? Form1 ???? ???????.
  3. ????? ???? ??? ????? ?????? Microsoft Word. ?????? ????? ???? ??????? ???????:
    1. ?? ??????? ??????? ???? ??? ????? ????.
    2. ??? ????? ??????? COM ????? ???? ????? ?????? Microsoft Word ?? ???? ??? ?????.

      ?????? ????? Microsoft Office 2003 "????????? Interop ????????" (PIAs). Microsoft Office XP ?? ????? PIAs ???? ???? ???????. ????? ?? ????????? ??? Office XP PIAs ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
      328912Microsoft Office XP ??????? ??????? ??????? ???????? ????????? (PIAs) ???????? ???????
    3. ???? ??? ????? ?? ???? ?????? ????? ????? ????? ?????????. ??? ??? ??????? ?????? wrappers ???????? ???? ?????? ???? ??? "???".
  4. ?? ??????? ???? ??? Toolbox ???? ???? ??????? ?? ????? ?? ??? Form1.
  5. ???? ????? ??????? ??? Button1. ???? ???? ????????? ???????? ???????.
  6. ?? ???? ????????? ???????? ??????? ???????? ???????? ???????
    Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles Button1.Click
    End Sub
    					
    ??:
    Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles Button1.Click
            Dim oWord As Word.Application
            Dim oDoc As Word.Document
            Dim oBuiltInProps As Object
            Dim oCustomProps As Object
            Dim oProp As Object
            Dim strValue As String
    
            'Create an instance of Word and make it visible.
            oWord = CreateObject("Word.Application")
            oWord.Visible = True
            'Create a new document
            oDoc = oWord.Documents.Add()
    
            'Get the Built-in Document Properties collection.
            oBuiltInProps = oDoc.BuiltInDocumentProperties
            'Get the value of the Author property and display it
            strValue = oBuiltInProps.Item("Author").Value
            MsgBox("The author of this document is " & strValue)        
    
            'Set the value of the Subject property.
            oBuiltInProps.Item("Subject").Value = _
                      "Knowledge Base article Q303294"
    
            'Get the Custom Document Properties collection.
            oCustomProps = oDoc.CustomDocumentProperties
            'Add a property named Knowledge Base Article
            'and give it a value of Q303294.
            oCustomProps.Add("Knowledge Base article", False, _
                      Office.MsoDocProperties.msoPropertyTypeString, "Q303294")
    
            'Display a message box to give the user a chance to verify the
            'properties.
            MsgBox("Select Properties from the File menu " _
                   & "to view the changes." & Chr(10) _
                   & "Select the Summary tab to view " _
                   & "the Subject and the Custom tab to view the Custom " _
                   & "properties.", MsgBoxStyle.Information, _
                   "Check File Properties")
    
            'Clean up. We'll leave Word running.
            oCustomProps = Nothing
            oBuiltInProps = Nothing
            oDoc = Nothing
            oWord = Nothing
    
        End Sub 
    					
  7. ?? ?????? ????????? ???????? ??????? ??? ???? Form1.vb:
    Imports Office = Microsoft.Office.Core
    Imports Word = Microsoft.Office.Interop.Word
  8. ???? F5 ?????? ???????.
  9. ???? ??? Button1 ???? ????? Microsoft Word.
???? ??? ????? ?????? ???????? ?? ????? ??????? ?????? ????? ??????? ???????. ??? ????? ??? ???????? ???????? ???? ???? ????? ?????? ??????? ????? ???? ??????? ??????? ??? "????? ??????? Q303294" ? ???? ????? ????? ???? ???? ???? "????? ???????." ??? ??????? ??? ????????? ???????? ??? Word ?? ???? ??? ????? ??? ??????? ???.

?????

????? ?? ?????????? ?? ?????? ?????? Microsoft ??????? ???? "??? ??????":
????? Microsoft Office ?? Visual Studio
http://msdn2.microsoft.com/en-us/library/aa188489(office.10).aspx
????? ?? ?????????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
303296????? ??????? "??????? ????????" ?????? ??? ?????? ????? ????? Office ???????? Visual C# .NET

???????

???? ???????: 303294 - ????? ??? ??????: 14/????? ???????/1428 - ??????: 7.4
????? ???
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Office Excel 2003
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft Office Word 2003
  • Microsoft Word 2002 Standard Edition
????? ??????: 
kbmt kbpia kbautomation kbhowto KB303294 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????303294

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

 

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