Visio ??? OLE ??????? ?? ????? ???? ????

???? ?????? ???? ??????
???? ID: 309603 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

?????

?? ???? ??? Microsoft Office Visio2from ?? ???????? ???? ?? ??? Microsoft Visual Basic ?? Microsoft Visual Basic ?? ??? ????????? (VBA) ?? ????? ???? ???? ?? ???? ??? ??????? ???? ???? Office ????????? ???

Microsoft ???????????? ?????? ???? ???????? ?? ??? ??? ???? ??, ???? ??? ??? ?? ?????? ?? ?????????? ??? ??? ?????? ???? ?? ????.. ?????? ???????? ?????? ?? ???? ????? ???????? ?? ??? ???????? ????? ??? ?? ???? ?? ????? ???? ???.. ?? ??? ????? ?? ?? ?? ????? ?? ?? ??? ???????????? ???? ?? ?? ??????? ?? ?????? ??? ????? ????? ???????????? ?? ????? ?? ???? ???? ?? ??? ???? ?? ??? ??.. Microsoft ?????? ???????? ?? ????? ????????? ?? ???????????? ?? ?????? ??? ?????? ?? ???? ???, ??, ?? ?? ???????? ?? ???? ??????? ?????????? ?? ?????? ???? ?? ??? ???????? ??????????????? ?? ?????? ?? ???????????? ????? ?? ??? ??????? ???? ??????..

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

??????? (?? ???OLE ???????) Visual Basic ??? ?? ???? ???? ????????? ?? ?? ?? ????????? ???? ?? ????????? ?? ????????? ?? ????? ????? ?????? ??? ????????? ?? ???? Visual Basic ??? ???????? ?? ???? ??????????? ????. ??? ???????? ???? ?? ?????????? ?????? ???????? ????????? ?? ?????? ?? ??????????? ?? ??? Visual Basic.

?????? ?? ???, Microsoft Visio ?? ??? ???????? ???? ??? ?????????? ????:
  • ???????/????????? ????????
  • ???????? ????????
  • ????? ????????
  • ???????? ?? ??????
  • ???????? ?? ???
  • ????? ????????
  • ????? ??? ????????
?? ?????????? ?? ?? ????? ?? ??????? ?? Visual Basic ??? ?????? ?? ??? ????? ???? ?? ??? ?????? ??? ??? ??? ?????? ?? ???, ???? ????? ???????? Visio ????? ????? ?? ???? ?? ????? ?? ??? ?? ???? ??? ?? ???? ?? ???????? ????????? ?? ???? ???? ?????, ???? ????? ???????? ???? ?????, ????, ?? ????????????, ??? ???????? ?? ???? ???, ?? ???????? ?? ???? ???? ??? ??, ?? ???? ???? ????????? ?? ?????? ???? ??? ??, ?? ???? Visio ???? ??? ???? ?????

??????? ????

?? ???? ??? ??? ????? ?? demonstrate Visio Microsoft Office 2007 Microsoft Office 2003, Microsoft Office 2002, Microsoft Visual Basic 6.0 ??, ?? ??? Visual Basic ?????????? ????? ????? ??? ?? ???? ?? ????????? ?? ????????? ???? ?? ??? ???? ????? Visio ?? ???????? ???? ?? ??? ????? ??? ????? ????? ?? ???? ????:
  1. Visio ?????? ????????? ?? ??? ??? ?????? ???????
  2. ?? ?? Visio ???????? ?????? ?? ??? ??? ????? (?????????? Visio.application ?? Visio.Documents)?
  3. ??? 2 ??? declared ???????? ?? ?? ??? GetObject ?? CreateObject ???? ?? ????? ?????
  4. Visio ?? ???????? ???? ?? ??? Visio ???????? ?? ???, ???????, ?? ?????? ?????????? ?? ????? ?????

??? 1: ?? ?????? Visio ?????? ????????? ??? ??????

???? Microsoft Office XP ?? Office 2003 ??? Microsoft Office ????????? ?? ????? ?? ??? ?????? Visio ?????? ????????? ??? ??????, ?? ????? ?? ???? ????:
  1. ?????, PowerPoint, Excel ?? Word, ??? ????? ???? ?? ?????????????? ?????????????, ?? ???? ???Visual Basic ??????.
  2. ????? ????????????? ??,??????.

    ???:????? ?? ??? Microsoft Visual Basic 6.0 ?? ????? ???? ??? ??????, ????? ??????????????? ????????????????? ??..
  3. ?? ???? ????????? ??????, ????? ??? ?????, ??????? ?? ????? ?? ??? ??? ?? Visio ?? ???? ?? ???? ?? ?? ??? ???? ?? ??? ????? ????:
    • ?? ??? Visio 2007, ????? ?? ??? ???? ?? ???Microsoft Visio 12.0 ?????? ???????????? ?????.
    • ?? ??? Visio 2003, ????? ?? ??? ???? ?? ???Microsoft Visio 11.0 ?????? ???????????? ?????.
    • Visio 2002, ?? ??? ????? ?? ??? ???? ?? ???Microsoft Visio 2002 ?????? ???????????? ?????.
?? ?? Microsoft Visio ?????? ????????? ?????? ?? ?????? ???, ???? ????????? Microsoft Visio ?????? ??? ?? Visio ???????? ???? ????? ???? ???? ?????? ?? ???????? ????????? ??? ????? ???? ???, ??????? ???? ???????? Visual Basic ?? VBA ?? ????????? ?? Visio ?? ???????? ???? ?? ??? ????? ???? ????? ??? ?? ??? ?????? ????????? ?? Visio ?????? ?????? ?? ??? ???

??? 2: ????? ???????? ??

????? ???? ?? Visio ???????? ??, ???? ?? ?? ??? ??? ???? ??????? Visio ???????? ??????, ???? Visio.application, Visio.Documents ?? Visio.Page.

?????? ??? ?? ???????? ?????? declaring ??? ???? ??????? ??????????????? ????????? ???????? ?? ?????? ???? ?? ??bindsVisio ????????? compile-??? ?? ???? ??-???? ??? ???? ?? ??? ???????? ??? ?? Visio ????: ??????? ?? ?????? ?????? ??? ???? ?? ??? ???? ????? ?????? ???? ??, ?? ???? ?????? ?? ????? ?? ??? ??? ?? ?????? ???? ???

???????? ???????? ?? ???? ??? ???? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
138138?? ?? ???, ID ???? ???????? types ???? VB ??? ??? ?? ???
????? ????? Visual Basic ???? declares ??AppVisio?? ??? ??? ???? ???????? ?? Visio.application ??????:

   Dim AppVisio as Visio.Application
				

??? 3: ??????? ??? ????

?? Visio ?? ?????? ???? ?? ??? ????? ?? Visual Basic ??????? ?? ????? ?? ???? ???:
  • CreateObject
  • GetObject
???????? ???? ?? ?? CreateObject ???? Visio ?? ?? ?? ??????? ?? ????? ??, ?? GetObject ???? Visio ?? ?? ???? ?? ?? ?? ??? ???????? ?? ????? ???? ??? ?? Visio ?? ???? ??????? ???????? ?? ??? ???? ???????? ??????? ??? ???? ?? ??? GetObject ?? ????? ?? ?? ???? ????

????? sample ???? ??? ???? ??AppVisioVisio ????????? CreateObject ?? ????? ???? ?? ??? ?? ??????:
   Dim AppVisio as Visio.Application

   Set AppVisio = CreateObject("Visio.Application")
				
??? ?????? ???, ?? ???? ?? ?? Visio ???? ?? ?? ??? ??, ????? ??? Visio ???? ?? ??? ??, ?? ?? ??? ??????? ?? ????? ?? ??? ??? ?????? Visio ??????? ?? ????? ???? ?? ???? ??? ???? ?? ??? ?????? ?????? ?? ????? ???? ???? CreateObject ?????? ??? ????? ?? GetObject ?????? ???? ???? ??, ?? ????? ??? ??? ?????? ?????? ?????:
   Dim AppVisio As Visio.Application

   On Error Resume Next

   Set AppVisio = GetObject(, "visio.application")

   If AppVisio Is Nothing Then
      Set AppVisio = CreateObject("visio.application")
   End If

				
???:?? ?? ???? ??? ?? CreateObject ?????? ?? ????? ???? Visio ????? ?? ??? ??????? ?????? ??? ?????? ?? ???::
Set AppVisio = CreateObject("Visio.InvisibleApp")
				
????? ?? ???? ??? ?? ???????? ???? ?? ??? ???????? ??? ????????? ???????? ?? ??????? ?????? ?? ?? ?????

?? ???? CreateObject ?????? ?? ??? InvisibleApp ???????? ?? ????? ?? ???? ??? ?????? ?? ??????? GetObject ?? ??? ????? ???? ?? ?????? ???? ??? Microsoft Visio 2000 ?? ????? Visio ????????? ??? InvisibleApp ???????? ?????? ???? ????

??? 4: Visio ????????, ???????, ?? ??? ?? ?????

??? 1 ?? 3 ???? ???? ?? ??? ?? Visio ????? ?? ???? ??? Visio ?? ???????? ???? ?? ??? ???????? ???

?????????? ????? ?????? Visio ??????? ????, ??? ??? ????? (????????) ??? ???? ???????? ?? ?????? ????? ?? ??? ??????? ?? ????? ???? ??, ??? ??? drops, ??? ??? ?????? ?? ?? ????? ?????? ?? ?? Visio ???? ???
Sub AutoVisio()

   
   Dim AppVisio As Visio.Application  ' Declare an Instance of Visio.
   Dim docsObj As Visio.Documents     ' Documents collection of instance.
   Dim DocObj As Visio.Document       ' Document to work in.
   Dim stnObj As Visio.Document       ' Stencil that contains master.
   Dim mastObj As Visio.Master        ' Master to drop.
   Dim pagsObj As Visio.Pages         ' Pages collection of document.
   Dim pagObj As Visio.Page           ' Page to work in.
   Dim shpObj As Visio.Shape          ' Instance of master on page.

   ' Create an instance of Visio and create a document based on the
   ' Basic Diagram template. It doesn't matter if an instance of
   ' Visio is already running, CreateObject will run a new one.
   Set AppVisio = CreateObject("visio.application")

   Set docsObj = AppVisio.Documents

   ' Create a document based on the Basic Diagram template that
   ' automatically opens the Basic Shapes stencil.
   Set DocObj = docsObj.Add("Basic Diagram.vst")

   Set pagsObj = AppVisio.ActiveDocument.Pages

   ' A new document always has at least one page, whose index in the
   ' Pages collection is 1.
   Set pagObj = pagsObj.Item(1)

   Set stnObj = AppVisio.Documents("Basic Shapes.vss")
   Set mastObj = stnObj.Masters("Rectangle")

   ' Drop the rectangle in the approximate middle of the page.
   ' Coordinates passed with the Drop method are always inches.
   Set shpObj = pagObj.Drop(mastObj, 4.25, 5.5)

   ' Set the text of the rectangle.
   shpObj.Text = "This is some text."

   ' Save the drawing and quit Visio. The message pauses the program
   ' so you can see the Visio drawing before the instance closes.
   DocObj.SaveAs "MyDrawing.vsd"
   MsgBox "Drawing finished!", , "AutoVisio (OLE) Example"

   ' Quit Visio.
   AppVisio.Quit

   ' Clear the variable from memory.
   Set AppVisio = Nothing

End Sub
				

??????

Microsoft Visio ?????? ??? ??????

Visio ?? ???????? ???? ?? ??? ???? ???? ?? ???? ??? ???? ??????? ?? ??? ????? Microsoft ??? ???? ?? ????:
HTTP://msdn2.Microsoft.com/en-us/Office/aa905478.aspx
Microsoft Visio ?????? ???? ?? ??? ???? ???? ?? ???? ??? ???? ??????? ?? ??? ?????? ?? ???, ????? Microsoft ??? ???? ?????:
(office.10) http://msdn2.Microsoft.com/en-us/library/aa217846 .aspx

Visio ?????????? ?????????? Kits

Visio 2002 ?????????? ????????? ??? ?? ??????? ???? ?? ??? ????? Microsoft ??? ???? ?? ????:
HTTP://www.Microsoft.com/downloads/details.aspx?familyid=d2845e80-6634-4703-9ad9-7e440ede12d7&displaylang=en

Visio 2003 ?????????? ????????? ??? ?? ??????? ???? ?? ??? ????? Microsoft ??? ???? ?? ????:
HTTP://www.Microsoft.com/downloads/details.aspx?familyid=557120bd-b0bb-46e7-936a-b8539898d44d&displaylang=en

?????? ????

????? ????-??-???? ?????? ???? ??????????? ?? ??? Visual Basic ?? ???? ???????????? ?? ??? ???????? ???? ??? ??? ???? ?? ??? ?????? ??:
Microsoft.public.VB.OLE.automation
Microsoft.public.Visio.developer.VBA

Visual Basic ??????

?? ????? ???? ???? ?? ???? ??? ???? ??????? ?? ???CreateObject??????, Visual Basic ?????? ???, ????? ????Microsoft Visual Basic ??????????? ???????????, ??????createobject ??????????????????? ???, ?? ???? ????????? ?? ??? ?? ???? ?? ??????

?? ????? ???? ???? ?? ???? ??? ???? ??????? ?? ???GetObject??????, Visual Basic ?????? ???, ????? ????Microsoft Visual Basic ??????????? ???????????, ??????getobject ??????????????????? ???, ?? ???? ????????? ?? ??? ?? ???? ?? ??????

???

???? ID: 309603 - ????? ???????: 04 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft Office Visio Standard 2007
  • Microsoft Office Visio Professional 2007
  • Microsoft Office Visio Professional 2003
  • Microsoft Visio 2002 Standard Edition
  • Microsoft Visio 2002 Professional Edition
??????: 
kbautomation kbprogramming kbvba kbhowto kbmt KB309603 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:309603

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

 

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