Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2005

Tip: Looking for answers? Try searching our database.

cross references collection & instr problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Where am I? - 20 Jun 2005 10:17 GMT
Hello,
Word 2002.
I am attempting to loop through the cross references collection, find a
match based on some text that I have already captured and insert a cross
reference to the item. The code is given below. The instr command does not
resolve correctly but using the debug window there should be a value found.
Please help.

Sub Generic_References(toref$)
Dim i%, x%
myHeadings = ActiveDocument.GetCrossReferenceItems(wdRefTypeHeading)
x% = 1
For i% = 1 To UBound(myHeadings)
   If InStr(myHeadings(i%), toref$) <> 0 Then
       Selection.InsertCrossReference ReferenceType:=wdRefTypeHeading, _
       ReferenceKind:=wdNumberRelativeContext, ReferenceItem:=i%
       Selection.TypeText " "
       Exit For        'once it is found it exits
   End If
Next i
End Sub
Where am I? - 20 Jun 2005 10:48 GMT
Fixed it. No action is required.

> Hello,
> Word 2002.
[quoted text clipped - 17 lines]
> Next i
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.