• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

VBA question

Engaged ,
Jul 05, 2017 Jul 05, 2017

Copy link to clipboard

Copied

Hello,

Sorry this isn't specifically related to InDesign. However, I'm trying to write a script in InDesign that can exchange data with Microsoft Word.

I've only started learning VBA.  So, as part of a test script I'm trying to search the data in the rows of a table.

This is what I've got, but  I'm not sure why it isn't working.

Any advice would be amazing!

Sub test()

Dim d As Document

Dim t As Table

Dim c1 As Cell

Dim c2 As Cell

Dim r As Rows

Set d = ActiveDocument

Set t = d.Tables(1)

Set r = t.Rows

For x = 1 To r.Count

Set c1 = r(x).Cells(1)

c1.Range.Find.MatchWildcards = True

c1.Range.Find.Forward = True

c1.Range.Find.Text = "Orion3"

   

        Do While True

       

        c1.Range.Find.Execute

       

            If c1.Range.Find.Found Then

       

            Debug.Print c1.Range.Text

       

            Else

       

            Exit Do

       

       

             End If

        Loop

       

Next

End Sub

TOPICS
Scripting

Views

302

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jul 05, 2017 Jul 05, 2017

Post in on a Word VBA forum, there's no lack of good ones.

Votes

Translate

Translate
Guru ,
Jul 05, 2017 Jul 05, 2017

Copy link to clipboard

Copied

LATEST

Post in on a Word VBA forum, there's no lack of good ones.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines