Link to home
Start Free TrialLog in
Avatar of calebS
calebS

asked on

ActiveDocument.content.find.text

This question relates to the same problem as posed in my question (https://www.experts-exchange.com/questions/20329989/Collection-of-Textbox-created-from-textboxes-in-various-frames.html)

My code is as below.

The user has fields marked in the document (ie '###_fieldname_###'), I present the user with a macro in which the user can fill in textboxes, these textboxes have tags that correspond to fieldnames.

The macro I run then replaces all occurrences of the field in the document with the text associated with the textbox per the textbox.tag.

What I am trying to do is have the form run an initial check to see whether each tbox.tag exists in the document, and then to disenable the textbox accordingly.

When I run this code however it ends up with all the textboxes being grey.

***************************************************
Private sub checkform()
  dim tbox as textbox
  for each tbox in tboxCollection
    if Activedocument.Content.Find.Text = tbox.Tag Then
      tbox.Enabled = true
      tbox.BackColor = white
    Else
      tbox.Enabled = False
      tbox.BackColor = grey
    end if
  next
End Sub


**Note I have also tried a variation of the above code in which I first disenabled all the boxes, and then ran the if-then statement only enabling the appropriate boxes, not disenabling any.
 
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi calebS,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept angelIII's comment(s) as an answer.

calebS, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
Avatar of SpideyMod
SpideyMod

per recommendation

SpideyMod
Community Support Moderator @Experts Exchange