Here's a quick version that uses the range object and displays message
boxes to let you know the results of the check for the first paragraph
of the current selection.
Nancy Hale
***
Sub TestParaForSEQFieldAtBeginning()
Dim vPara As Paragraph
Dim vRng As Range
Dim iCnt As Integer
Set vRng = Selection.Range.Paragraphs("1").Range
vRng.Collapse wdCollapseStart
vRng.MoveEnd Unit:=wdCharacter, Count:=1
iCnt = vRng.Fields.Count
If iCnt < 1 Then
MsgBox "There are no fields in this paragraph.", vbOKOnly
Else
If vRng.Fields(1).Type = wdFieldSequence Then
MsgBox "This paragraph starts with a SEQ field."
Else
MsgBox "This paragraph does not start with a SEQ field."
End If
End If
End Sub
-----Original Message-----
From: Green, Christopher [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 14, 2007 5:40 PM
To: Brierley, Sean; TCP List
Subject: Re: [TCP] Word VBA question
>> On Behalf Of Brierley, Sean
>> Sent: Wednesday, March 14, 2007 1:22 PM
>> How do I use VBA to see if the first item in a paragraph is a Field
>> (specifically, a Seq field)?
>>
>> Anyone know?
>I tried using the range object first without luck. Here's a version
using selection. If field count returns 1 that's your answer. Not very
>elegant.
>Selection.Range.Paragraphs("1").Range.Select
>Selection.Collapse wdCollapseStart
>Selection.MoveRight wdCharacter, , True
>MsgBox Selection.Fields.Count
______________________________________________
Author Help files and create printed documentation with Doc-To-Help.
New release adds Team Authoring Support, enhanced Web-based help
technology and PDF output. Learn more at www.doctohelp.com/tcp.
DOCUMENTATION & TRAINING WEST 07: THE USER EXPERIENCE
April 18-21, 2007 ~ Vancouver BC ~ Marriott Pinnacle ~ free city tour
40+ sessions * free workshops * free iPod offer * www.doctrain.com
_______________________________________________
Technical Communication Professionals
Post a message to the list: email [EMAIL PROTECTED]
Subscribe, unsubscribe, archives, account options, list info:
http://techcommpros.com/mailman/listinfo/tcp_techcommpros.com
Subscribe (email): send a blank message to [EMAIL PROTECTED]
Unsubscribe (email): send a blank message to [EMAIL PROTECTED]
Need help? Contact [EMAIL PROTECTED]
Get the TCP whole experience! http://www.techcommpros.com