Jump to content

Problem with transfering user form input to document


Recommended Posts

Posted

Hello,

I have a form, created via VBA, which opens as soon as a user opens the word document (2003).

As i am new to this method of transfering user input i was wondering how the heck do i transfer the user input from the form to the activedocument, and at certain locations in that document.

I have tried creating bookmarks and referencing them (which i can do) but i cant seem to insert user inputted text from the form at this location.

I have tried Selection.TypeText cust_name.Text but this just inserts the text wherever the selection is and not at a specified location.

Is there a method to use which specifies an exact location and then inserts new text to that location in the active document?

I am now pulling my hair out with this so any help will be great.

Thanks in advance

Karl


Posted

Hello,

Just found a way that works for me.

Set myrange = ActiveDocument.Content

With myrange.Find

.ClearFormatting

.Replacement.ClearFormatting

.Text = "whatevere text to find on doc"

.Replacement.Text = textbox1.Text

.Execute Replace:=wdReplaceAll

End With

Perhaps not the best but it works.

Cheers

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...