C
Chris
I posted the following on microsoft.public.word.vba.general.
---------------------------------
I got the following response. I'm having trouble even running Ms
Meister's example, but I'd appreciate any light you can shed on how I
handle Visio if I can activate it.
Cindy Meister responded:
Well, I can only give you the Word side of things. You'll need to ask
in a Visio group to get help with automating Visio.
Any OLE object embedded in a Word document is - as far as Word is
concerned - a graphic. It's either an InlineShape (Word treats it like
a text character) or a Shape (text wrap formatting is applied).
Both InlineShapes and Shapes have an OLEFormat.Object property that
lets you activate and access the automation interface of an OLE object.
Mainly, I do this with Excel, so here's an example for that you can use
as a basis:
Sub ExcelObject()
Dim of As Word.OLEFormat
Dim oXL As Excel.Workbook
Set of = ActiveDocument.InlineShapes(1).OLEFormat
of.Activate
Set oXL = of.Object
Debug.Print oXL.Name
End Sub
Note that you have to set a reference to the object library of what you
want to manipulate if you want to use intellisense. Otherwise, you have
to Dim oXL As Object (late-binding). I recommend you at least start
with a reference and Intellisense if you don't know Visio's object
model at all. At a later point you can remove it and change any
declarations to use the Object type.
Now you have to work with the Visio folks to find out
1. What type of object is stored in a Word document
2. How to declare and refer to that in your code
3. The syntax to save it to a separate file.
Cindy Meister
INTER-Solutions, Switzerland
---------------------------------
Our Word documents include Visio objects whose original files are now
scattered. I need VBA to do the equivalent of double-clicking to open
the object in Visio, saving as a file, and then returning to Word to
find the next Visio object. I've been looking at examples of calling
other apps, but I don't understand how to move between Word and Visio
as I described.
I got the following response. I'm having trouble even running Ms
Meister's example, but I'd appreciate any light you can shed on how I
handle Visio if I can activate it.
Cindy Meister responded:
Well, I can only give you the Word side of things. You'll need to ask
in a Visio group to get help with automating Visio.
Any OLE object embedded in a Word document is - as far as Word is
concerned - a graphic. It's either an InlineShape (Word treats it like
a text character) or a Shape (text wrap formatting is applied).
Both InlineShapes and Shapes have an OLEFormat.Object property that
lets you activate and access the automation interface of an OLE object.
Mainly, I do this with Excel, so here's an example for that you can use
as a basis:
Sub ExcelObject()
Dim of As Word.OLEFormat
Dim oXL As Excel.Workbook
Set of = ActiveDocument.InlineShapes(1).OLEFormat
of.Activate
Set oXL = of.Object
Debug.Print oXL.Name
End Sub
Note that you have to set a reference to the object library of what you
want to manipulate if you want to use intellisense. Otherwise, you have
to Dim oXL As Object (late-binding). I recommend you at least start
with a reference and Intellisense if you don't know Visio's object
model at all. At a later point you can remove it and change any
declarations to use the Object type.
Now you have to work with the Visio folks to find out
1. What type of object is stored in a Word document
2. How to declare and refer to that in your code
3. The syntax to save it to a separate file.
Cindy Meister
INTER-Solutions, Switzerland