???? ID: 288902 - ????? ???????: 02 ?????? 2010 - ??????: 2.0

Office ??????? ????? ?? GetObject ?? CreateObject ???????

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.

?? ????? ??

??? ?? ??????? ???? | ??? ?? ??????? ????

??????

?? ???? ?? ????? ???? ?? ????? ??????? ?? ????? ???? ??GetObject, ??CreateObjectMicrosoft Office ??????????? ?? ??????? ??????? ?? ??? ????????GetObject, ??CreateObject?????? ??? ?????? ?????? ??? ?? Microsoft Visual Basic ?? Microsoft Visual Basic ?? ??? ????????? (VBA) ???? ???????, ??????? ?? ?? ???? ???? ?? ??? Microsoft Visual C++ ??? ?? ?????? ?????GetObject???? ??? ???? ?? ???GetActiveObjectAPI ?? ??????CreateObject???? ??? ???? ?? ???CoCreateInstanceAPI.

???? ???????

GetObject

GetObject??????? ????? ??? ?? ???? ?? ??? ???????? ?? ??? ??????? ???? ?? ??? ???????? ??? ??? ???? ?? ??? ??? ??? ????? ???GetObject, ????? ??????? ?? ???? ?? ?? ???????? Microsoft Office ?? ??? ????????? ??????????? ??:
set xlApp = GetObject(, "Excel.Application")
				
??? Microsoft Excel ?? ?? ???????? ?? ??? ?? ?? ?? ??? ?? ????????, xlApp ?? ?? ?????? ?? ?? ??? ???????? ???????? ???? ?? ????? ?? ???? ??? ??? ???????? ?? ??? ??, ?? ???? ????? trappable ??-???? ?????? ????? ??????? ???? ??:
'429' ??-???? ??????:
ActiveX ??? ???????? ???? ??? ????
??? Microsoft Excel ?? ?? ?? ???? ???????? ?? ??? ???,GetObjectattaches ??????? ???? ???? ?? ???? ?? ?? ???? ?? ??? ??? ??? ?? ??? ???? ???? ?????? ??, ?? ???? ???? ?? ??? ???GetObject????? ??????? ?? ????? ???? ??? ?? ?? ??? forth attaches ?????

???? ??????? ???? ?? ??? ??? ??????? ?????? ?? ???? ??? ??? ?? ????? ??? ?? ?? ?????? ??? ???? ??? ???????? ?? ???? ?????? ?? ???, ??? Excel ?? ??????? ?? ???? ???? ????????????? Book2 ??? ?? ??? ?? ??? ??, ?? ????? ??? attaches ??????????? ?? ?????? ?? ??? ??? ?? ??? ????? ???? ??? ?? ?? ??????????? ?????? ???? ??:
Set xlApp = GetObject("Book2").Application
				

CreateObject

CreateObject??? ??????? ????? ?? ??? ?? ??????? ?? ??????? ???? ?? ??? ???????? ??? ?????? ?? ???::
set xlApp = CreateObject("Excel.Application")
				
???? ?? ?? ???? ????? SingleUse ?? MultiUse ?? ??? ??? ??????? ??, ???? ????? ????????? ?? ???? ?? ?? ????? ???? ???? ?? ???? ??? ?? ?? ?????????? distinction deciding ?? ?? ???? ???? ????? ???????? ??? ?? ??????? ?? ??? ?? ???? ?? ??????? ?????? ?? ???, ???? MultiUse ????? ?? ??? ??? ?? ???, ??????? ???? ?? ???? ?? ???????? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?????? ?????? ????? ????????? ?? ???? ??? ?? ?? ???? ?? ??? ??? ????????

??? ???? ???? ????? ?? ?????? ?? ??? ??? Microsoft Office ?? ??? ??? ?????? ??????????? ???? ??? ?? ??????? ?? ??????? ??????? ?? ????????? ?? ???? ?? ????? ??? ??? SingleUse ?? MultiUse, ??? ??? UserControl ?? ??? ???? ?? ???? ??, ?? ???????? ???? ?? ??? defaults ?? Microsoft Office ??????????? ?? ??? ???? ???, ?? ?? ??? ??????? ??????????, ?? ???? ????? ????? ?? ??? ?????? ????

?? ?????? ?? ??????? ?????? ?????? ?? ??????? ????
??????????????Instancing?? UserControl??? ??ClassName
Excel 97, 2000, 2002, 2003, 2007????SingleUse??????XlMain
Word 97, 2000, 2002, 2003, 2007????SingleUse??????OpusApp
PowerPoint 97????MultiUse???????PP97FrameClass
PowerPoint 2000????MultiUse???????PP9FrameClass
PowerPoint 2002????MultiUse???????PP10FrameClass
PowerPoint 2003????MultiUse???????PP11FrameClass
PowerPoint 2007????MultiUse???????PP12FrameClass
????? 97???SingleUse??????OMain
Access 2000, 2002, 2003, 2007????SingleUse??????OMain
Project 98, 2000????MultiUse??????JWinproj-WhimperMainClass

The main window class name is helpful for calling theFindWindowAPI when you want to find out conveniently if any instance is already running. The UserControl property is a boolean property that indicates whether the server application automatically shuts down when its last reference is released (set to nothing). The???? ?????????? ???? ?? ?????? ?? (???? ?? ??? ?????? ???? ?? ???? ???? ?? ??? ????? ?????? ?? ???? ???? ??? ??) ?????? ??? UserControl ??? ?? ??????? ???? ?? ?????? ???? ???

???????? ???, Microsoft ??????? ???? ?? ?????????? ?? ????? ???? ?? ???? ?? ?? ?? ??????? ?? ??? attaching ?? ???? ???? Office ????????? ?? ??? ??? ?????? ?????? ???? ???? ????? ????????? ProgID, ?? ????? ?? ?? ??????? ????? ?? ???? ??? ????? ?? ?? ?????????? ?? ???? ?? ??? ??? ???? ProgIDs, ???? Excel.Sheet ?? Word.Document ?? ??? forth, OLE (???????? ??????? ?? Embedding) ??? ????? ?? ??? ?????? ?? ?? ????? ???????? ?? ??? ????? ???? ???? ?? ?? ??? ???? ??CreateObject. ????????? ProgID ?? ?????, ?? ?? ?? ?????? ??????? ???????? ?????? ??? ?? (????????? ????) ?? ??????? ?? ??? ????? ?? ??????? ???

?? ???? ??????? ????? ?? ??? ?????? ?? ???, ?? ??? ???? ??? ?????? ?????? ?? ??? ???????? ?????????? (??? ?????? ??) ????? ????? ?? ??? ??? ???????? ???? ??? ??? ?? ??????? ?? ?????? ?? ?? ???????? ?? ???????? ???? ?? ???? ??? ???? ??? ????? ???? ?? ??? ?????????? ?? ??? ???? ???? ????? ???, ?? ???? UserControl ??? ??? ???? ?? ???True?? ?? ???? ??? ?????? ??????? ????? ??? ??? ?? ??? ?? (??????? UserControl ??? ??True) ?? ?? appropriately ?? ?????????? ??? ????????? (??????? ???? ???????? ?????? ???? ???) ??? ???? ???

???:Word, ?? ??? UserControl ??? ?? ????-????? ?? ???? ?? ???? ?? ???? ?? ??? ???? ?? ??? ???? ?? ??? ????? Word ????? ???? ?? ??? ?? ????? ?????? ?? ???? ???? ??? ???

??????

???? ??????? ?? ??? GetObject/CreateObject ?? ????? ???? ?? ???? ??? ?? ??? ?? ???? ??? ????? ?? ??? ????? ?? ??????? ?? ????? ???? ?? ??? Microsoft Office, ?? ??? ?????? ????? ???? ???????? ?? ????? ???? ?? Microsoft ???????? ??? ?????:
222783  (http://support.microsoft.com/kb/222783/ ) PPT2000: CreateObject ???? ????? ??? PowerPoint ????
188546  (http://support.microsoft.com/kb/188546/ ) BUG: Word ?? ???????? ??? ?? ??????? ??????? ?? ??? ??? ??? ?????? ???? ??
265385  (http://support.microsoft.com/kb/265385/ ) ???????: PowerPoint 97 ?? PowerPoint 2000 ?????? ?? ???????
259940  (http://support.microsoft.com/kb/259940/ ) BUG: Word 2000 Does ???? ?? Keybindings.ClearAll ????? ?? ??? ????
258511  (http://support.microsoft.com/kb/258511/ ) HOWTO: ??????? ???? ?? ??? ??????? ?? ??? Office ????????? ????? ?????
249169  (http://support.microsoft.com/kb/249169/ ) ??? ????????? ???? ?? ??? ?? ?????? ??? PPT97: PowerPoint 97 ??? ?? ??? ???? ?? ???
159922  (http://support.microsoft.com/kb/159922/ ) XL97: ????? Quit ???? ???? ?????? ???????? ?? ????

???? ???? ???? ??:
  • Microsoft Office Excel 2007
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Excel 2000 Standard Edition
  • Microsoft Excel 97 Standard Edition
  • Microsoft Office Access 2007
  • Microsoft Office Access 2003
  • Microsoft Access 2002 Standard Edition
  • Microsoft Access 2000 Standard Edition
  • Microsoft Access 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 Project 2000 Standard Edition
  • Microsoft Project 98 Standard Edition
  • Microsoft Office Word 2007
  • Microsoft Word 2002
  • Microsoft Word 2000
  • Microsoft Word 97 Standard Edition
??????: 
kbautomation kbinfo kbmt KB288902 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:288902  (http://support.microsoft.com/kb/288902/en-us/ )