0 Replies Latest reply on Jun 2, 2008 5:32 PM by (Nigel_Beames)

    [CS3, VB] How to find text and store as a string

      Dear all,
      I'm stymied again with what seems a simple thing. But you hear that a lot.
      I want to find a reference number in a document and then use that to create a filename later on.

      I've got this far, adapting code from another topic:
      myString = "Release No. ^9^9^9^9"
      Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
      Set myInDesign = CreateObject("InDesign.Application.CS3")
      Set myDocument = myInDesign.ActiveDocument
      myInDesign.FindTextPreferences = idNothingEnum.idNothing
      myInDesign.FindTextPreferences.FindWhat = myString
      set myFounded = myDocument.findText()
      call myInDesign.select(myFounded.item(1))

      I know I shouldn't have to select it as such, but anyway, I'm stuck converting the found text into a string. And then I want to just grab the four digits.

      Also, could you provide the code to put that into a if/then statement in case it doesn't find anything?

      Thanks

      Nigel