Results 1 to 10 of 10

Thread: Control Array In Word VBA

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    88

    Control Array In Word VBA

    I have created a control array in visual basic so that when you type text into one textbox it gets copied into another texbox. This works fine, but i was trying to emulate this with VBA in a word document. I know you cannot use control arrays in VBA, but I cannot find on the internet many solutions (that I can get working).

    Any ides would be helpful cheers.

    caz

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Control Array In Word VBA

    Control Arrays are not available in VBA.

    You could use the _Change event of the first textbox to populate the value in the second.
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    88

    Re: Control Array In Word VBA

    yeh i have tried using the change event, but have not found out how to make the text copied into the second textbox.

    Thanks for your help.

    caz

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    88

    Re: Control Array In Word VBA

    Thanks DKenny, I have found and implemented a simple solution just using the code.

    Text1.Text = Text2.Text

    And this worked excellently but do you think there is anyway i could type into the document and it go into the textbox i dont really know the appropiate code e.g.

    Document.Text = Text2.Text

    Thanks again for your help.

    caz

  5. #5
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Control Array In Word VBA

    Now I'm confused. Do you want
    A/ the text of the document put into a text box (as per "anyway i could type into the document and it go into the textbox")
    or
    B/ The text from a text box put into a document (as per "Document.Text = Text2.Text")

    If A/ is the requirment, do you want all of the text from the doc or just a section? What do you do when the document is too long to all fit into a textbox?

    So I gues my question is
    What are you really trying to acomplish here?
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    88

    Re: Control Array In Word VBA

    Well I am trying to create a simple language translation macro, my program so far consists of using the autocorrect feature to translate text entered into the document. I wanted a feature of the macro that the user could see in a text box what they typed before the autocorrect changed the word. I was going to use two textboxes but i was wondering if i could type into the document and the unchanged text gets sent to the text box, because the autocorrect feature does not work in a textbox.

    Thanks for your help, So its option A.

    caz

  7. #7
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Control Array In Word VBA

    Have you considered turning Autocorrect off?
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    88

    Re: Control Array In Word VBA

    but i want autocorrect on so it changes the words.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    88

    Re: Control Array In Word VBA

    The key feature of using a textbox was that in a textbox, autocorrect doesnt work so if the text got copied to the textbox it would be in its original format before being changed with autocorrect.

    Thanks for the help.

    caz

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    88

    Re: Control Array In Word VBA

    Just realised this cannot be done. so i have gone another route of using 2 textboxes, but i need to allow 1 textbox to have autocorrect on, anyone know how to do this?

    caz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width