VBA code to display properties of linked OLE objects

L

L Mehl

Hello --

I have many objects in a doc which I have linked using

Insert | Picture | From File: Link to File

I want to confirm that I have linked them correctly.

Does anyone know of VBA code to find these objects in a doc and list
selected properties of them?

Thanks for any help.

Larry Mehl
 
M

macropod

Hi Larry,

If you press Alt-F9, Word will toggle the field code view on/off. You can
use that, without any code, to examine the links.

Other than that, try:

Sub ListFields()
Dim oFld As Field
If ActiveDocument.Fields.Count > 0 Then
For Each oFld In ActiveDocument.Fields
With Selection
.EndKey Unit:=wdStory
.InsertAfter vbCrLf
.EndKey Unit:=wdStory
.TypeText Text:="{" & oFld.Code & "}, " & oFld.Result
End With
Next oFld
End If
End Sub

This will report all field codes and their results at the end of you
document.

Cheers
 
L

L Mehl

Hi Macropod --

Thank you for the code.

Larry


macropod said:
Hi Larry,

If you press Alt-F9, Word will toggle the field code view on/off. You can
use that, without any code, to examine the links.

Other than that, try:

Sub ListFields()
Dim oFld As Field
If ActiveDocument.Fields.Count > 0 Then
For Each oFld In ActiveDocument.Fields
With Selection
.EndKey Unit:=wdStory
.InsertAfter vbCrLf
.EndKey Unit:=wdStory
.TypeText Text:="{" & oFld.Code & "}, " & oFld.Result
End With
Next oFld
End If
End Sub

This will report all field codes and their results at the end of you
document.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top