?? Office ????????? ?? ????? ?? ??? WebBrowser ???????? ?? ????? ???? ????

???? ?????? ???? ??????
???? ID: 243058 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

Office ???????? ?? ??? ????? ???? ??? ?? Visual Basic ??? ?? ?????????? ?? ????????? ???? ?? ??? ?? ????, ????? OLE ???????? ???????? ?? ????? ???? ??? ???????? OLE ???????? ?? ????? ?? ??? ???? ?????? ???? ????, ?? ???? ???? ??????? ?? ???? ?????? ???????? ?? ???? ???? ?? ??-????? ActiveX ???????? ???????? ?? ??? ??? ?????? Fortunately, Microsoft WebBrowser ???????? ?????? ???????? ???? ???

?? ???? ????????? ???? ?? ?? ??????? ???? ?? ??? ??? ?????? Office ????????? ?? WebBrowser ???????? ?? ????? ?? Visual Basic ?? ???? ????????? ???? ?? ??? ???? ?????

???? ???????

ActiveX ???????? ??? ?? ???? ???????? OLE ???????? ?? ActiveX ???????? ?? ??? ??????? embeddable OLE ???????? ??? ?? ??????? ???????? ????????, ???? ?? ?????? ???? ActiveX ???????? ?? ??????? ???? ?? ??? ???????? ??? ??? ???????? ???? ???? ?? ???? ???? ????, ?? ?? ????? ????????? ??? ?????, merely (???? Internet Explorer) ?? ?????? ?? ???? ?? ??? ?? ?? ???? ?????????? ?? ???? ?? ?????? ??? ???????? ???? ?? ??? ?? ?? ???? ?? (???? ??? ?????? ?????)?

Microsoft Visual Basic ?????? ???? ???? ??????? ??? ???? ActiveX ?? ????????? ????? ???? ????, ?? ?? Internet Explorer ?? ???? WebBrowser ???????? ?? ?????? ?? ????? ?? ??? ?? ??-??? ?? ??? ?? ???? ???? WebBrowser ???????? (Shdocvw.dll) Internet Explorer ?? ?? ??? ?? ?? ???? ???????? ?? ?????? Internet Explorer ??????? ???? ?? ???? ???

Office ????????? ????? ?? ??? Visual Basic ????????? ?? ?? ?????

Office ???????? ?? ????? ?? ?? ???? Visual Basic ????????? ????? ?? ??? ????? ????? ?? ????? ????:
  1. Visual Basic ?? ??????? ???? ?? ???? ???? ??? ????????? ?????? Form1 ???????? ??? ?? ???? ??..
  2. ???????????????, ?? ??? ???????????? ?? ??????????? ????? ?? ??????? ?? ??? ?? .. ??? ????? ????? ???, Microsoft ?? ?????? ????????????? ????? ????????Microsoft ????????? ????????. ????? ????? ??? ???? ?????? ?? ??? ??? ????? ?????
  3. WebBrowser ????????, CommonDialog ?? ??????? ????? ???????? ?? ?? CommandButton Form1 ?? ????
  4. ????, ?????? ????? ??? ??? ????? ??? Form1 ?? ???:
    Option Explicit
    
    Dim oDocument As Object
    
    Private Sub Command1_Click()
       Dim sFileName As String
       
     ' Find an Office file...
       With CommonDialog1
          .FileName = ""
          .ShowOpen
          sFileName = .FileName
       End With
       
     ' If the user didn't cancel, open the file...
       If Len(sFileName) Then
          Set oDocument = Nothing
          WebBrowser1.Navigate sFileName
       End If
    End Sub
    
    Private Sub Form_Load()
       Command1.Caption = "Browse"
       ' For the 2007 Microsoft Office documents, change the .Filter parameter of the 
       ' With CommonDialog1 statement to:
       ' .Filter = "Office Documents " & _
       '      "(*.docx, *.xlsx, *.pptx)|*.docx;*.xlsx;*.pptx"
       With CommonDialog1
          .Filter = "Office Documents " & _
          "(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt"
          .FilterIndex = 1
          .Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly
       End With
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
       Set oDocument = Nothing
    End Sub
    
    Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, _
    URL As Variant)
       On Error Resume Next
       Set oDocument = pDisp.Document
    
       MsgBox "File opened by: " & oDocument.Application.Name
    End Sub
    					
  5. ??? ?????F5????????? ?? ?????? ?? ?? ???????????????,?????????? ????? ????? ???? ?? ????? ?? Word, Excel ?? PowerPoint ????? ??? ??????? ???? ?? ???? ???????????? WebBrowser ???????? ?? ???? ????????? ????? ?????? ??? ????? ????? ????? ???? ?? ?? ?? ????? ???? ?? ?? Office ????????? ?? ??? ????????? ???? ???

?? ?? WebBrowser ???????? ?? ????? 2007 Microsoft Office ??????????? ??? ?? ????? ???? ?? ??? ????

????? ????? ?? ???? ?? ?? WebBrowser ????? ????????:
  • WebBrowser ???????? asynchronously navigates ?????????? ?? ???? ???? ???? ?? ?? ?? ??? ???? ???????? ???? ?? ??? Visual Basic ????????? ???? ???? ?? ???? ???????? ???? ??? ?? ??? ??? ??? ?? ?? ??? ?? ?? ?? WebBrowser1.Navigate ??? ????? ??? ?? ???? ???????? ?? ???????? ???? ?? ??? ?? ??? ???, ?? ?????NavigateComplete2????? ????? ?? ?? ????? ????? ?? ???????? ?????? ?????? ??? ??????????????? ???WebBrowserOffice ???????? ???????? ?????? ?? ??????? ???? ?? ??? ???????? ??? ????? ??? ??? ?????? ??? ??oDocument.
  • ?? ???????? ?? ?? ???? ????????? ??? ?? ?? ???? WebBrowser ???????? ?? ?? Office ???????? ?? ?? ?? ?????? ?? ??? ???????? ???????? ??? ?? ?? ??? ?? ???? ???? ??? ??????, ???????? ???????? ??? ??? Word ????????? ?? Excel ?????????? ?? ??? ??? ?? ??????? ???? ??? ?? ?? ????????? ?? ????? ???? ?? ???????? ?? ????? ???? ?? ?? ?? ?? ??? ??? ?? ???????? ??? ???
  • WebBrowser ?? ??????? ??????? ?? ???, ????? ??? ?? ????? ???? ?? ??? ???????? ????? ????? ?? ???? ???? ??? ????? ???? ????? ??? ??????? ???? ?? ???? ??, ??? ???? ??????? ????? ??? ???? ??? ??? ???? ???
       WebBrowser1.Navigate "about:blank"
    					

Microsoft Office 2003 ????????? ?? Office ?? ????? ????????? ??? ???? ????? ?? ?? ?? WebBrowser ????? ???? ?? ??? ????????

????? ????? ?? ???? ?? ?? WebBrowser ????? ????????:
  • WebBrowser ???????? navigates ?????????? ?? ??? asynchronously. ???? ???? ?? ?? ?? ?? WebBrowser1.Navigate ???, ??? ???? ???????? ???? ?? ??? ???? Visual Basic ????????????????????? ???? ??? ?? ??? ?? ??? ??? ??? ?? ???????? ?? ???? ??????? ?? ?? ??? ???, ?? ???? ?? ????? ????NavigateComplete2????? ??? ?? ?? ?? ???????? ?????? ??? ???? ?? ??? ??? ?????????????Office ???????? ????????, ??, ????? ??? ??? oDocument ???? ?? ??? ??? ??, ??? ?????? ?? ??????? ???? ?? ??? ??? WebBrowser ???????? ?? ??? ???? ????
  • WebBrowser ???????? ???? ???? ?? ?????? ???? ????? ??? ???? ???????? ???? ???? ?? ???? Visual Basic ???? ?? ??? ????? ???? ?? ???, ???? ?????? OLE ???????? ???????? ?? ????? ???? ????? ???
  • ?????? WebBrowser ???????? ????????: ?? ??? docked ????? ???????? ?? Office ????????? ?? ????????? ???? ?? ????? ?? ???????? ????? ????? ???? ?? ??? ?? ????? ?? ?????? ?? ??? ??????? ?? ????? ?? ???? ???:
       With oDocument.Application.CommandBars("Standard")
          .Position = 4 '[msoBarFloating]
          .Visible = True
       End With
    					
    Internet Explorer (5.0 ?? ????) ?? ?? ??????? ????? ??? ?? ????? ?? ????? docked ???????? ????????? ???? ?? ??? ???? ?????? ??:
     ' This is a toggle option, so call it once to show the 
     ' toolbars and once to hide them. This works with Internet Explorer 5
     ' but often fails to work properly with earlier versions...
       WebBrowser1.ExecWB OLECMDID_HIDETOOLBARS, OLECMDEXECOPT_DONTPROMPTUSER
    					
  • ???? ????????? ??? ?? ?? ???? WebBrowser ???????? ????, ?? ???????? ???????? ??? Office ???????? (??????, ??? Word ????????, ?? ??? ?????????? Excel) ?? ?? ?? ?????? ?? ??? ???? ?? ??? ?? ????? ???????? ???? ?? ???????? ?? ?? ?? ???? ????????? ?? ????? ?? ???????? ?? ????? ????, ?? ?? ??? ??? ?? ???????? ??????? ?????

    ???? ??????? ?????? ?? Office ???? ?????, ?? ????? ????? ??? ??? ???? ??? ?? ?? ??????? ?? ?? WebBrowser ????????, ????? ?? Word ???????? ?? ??? ??? ????, ?? ????? ??????? ??? ?? ?? ?? ????? ????? ???????? ????????? ????, ????? ???????? ?? ???? ?? ??? ???? ????? ?? ????? ?????? ??? ??? ???? ????? ???? ?? ???? ?? ?? ????? ???? ???? ?? ?????
  • ??? WebBrowser ?? ???? ??????? ??????? ?? ????? ???? ?? ???????? ????,????? ?? ??? ???? ???? ??? (?? ??? ???? ??????? ????? ??? ???? ??? ???), ?? ??? ?? ????? ??????? ????? ????? ?? ??????? ????:
       WebBrowser1.Navigate "about:blank"
    					

??????

Visual Basic ??? WebBrowser ???????? ?? ???? ??? ???? ??????? ?? ??? ?????? ?? Microsoft ???????? ??? ????? ?? ??? ????? ???? ???????? ?? ????? ????:
162719Visual Basic 5.0 ?? WebBrowser ???????? ?? ????? ???? ????
188271??? ???????? ???????? ?? ??????? ?? VB ?? ??????? ???? ?? ??? ???? ????
191692Shdocvw.dll PDW ????? ?????? ??? ????? ???? ??
238313Accessing the Internet Explorer Document Object Model from Visual Basic
927009??? ?? ????? ????? ?? ?? ?? Windows Internet Explorer 7 ??? ?? 2007 Microsoft Office ????????? ???????? ????? ?? ?????? ????

???

???? ID: 243058 - ????? ???????: 02 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft Office Excel 2007
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Excel 2000 Standard Edition
  • Microsoft Excel 97 Standard Edition
  • Microsoft Office PowerPoint 2007
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft PowerPoint 2000 Standard Edition
  • Microsoft PowerPoint 97 Standard Edition
  • Microsoft Office Word 2007
  • Microsoft Word 2002
  • Microsoft Word 2000
  • Microsoft Word 97 Standard Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
??????: 
kbexpertiseinter kbhowto kbmt KB243058 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:243058

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

 

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