PDA

View Full Version : Get index using RegExp



mdmackillop
10-07-2006, 09:30 AM
I've created some code to display selected photographs based on their index number in a report. The way the report is constructed lists the photo refernces within brackets, which may be in any of the following forms. The report is 300+ pages with 5,500 photo references, so a bit of a problem to "regularise".
(X078)
(A078/A079/A080)
(X078, X079)
(AB078 - AB083)
I would like to "extract" the reference number by running the macro when the insertion point is within the reference.

fumei
10-07-2006, 10:58 AM
A question. If the Selection is in: (AB078 - AB083) , which number would be extracted? All of them?

mdmackillop
10-07-2006, 11:02 AM
Hi Gerry,
Just the number with the insert. My userform will have Next and Previous buttons to deal with this situation.

matthewspatrick
10-08-2006, 09:52 AM
Sorry Malcolm, it's still not clear :think:

mdmackillop
10-08-2006, 10:25 AM
Hi Patrick,
Here's a small sample with the userform as WIP. I'm looking to initialise the Userform with the reference containing the insertion point.

mdmackillop
10-08-2006, 11:26 AM
OK, I've finally got my brain in gear. Much simpler than I was thinking!

Sub Shows()
UserForm2.Show False
UserForm2.TextBox1 = Selection.Words(1)
End Sub