VBA - Insertion point

M

Mike Faulkner

Could you let me know what VBA to use to determine whether the insertion
point is in a Field.

Many thanks
Mike
 
H

Helmut Weber

Hallo Christian,

hi Mike,

may I try to add my own decent bit,
based on Christian's idea,
as I've not heard about "InRange" before.

Sub test44444()
Dim r As Range
Dim l As Long
Set r = ActiveDocument.Range
r.End = Selection.Start
l = r.Fields.Count
If l > 0 Then
If Selection.InRange(r.Fields(l).result) Then
MsgBox "Inside field"
End If
End If
End Sub

But doesn't work with
ActiveWindow.View.ShowFieldCodes = true.

If you need a solution for that, too,
ask again.

Gruß

Helmut Weber, MVP WordVBA

"red.sys" & chr$(64) & "t-online.de"
Win XP, Office 2003
 

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