Using delimiters

E

EllenM

Hello, I am trying to extract data from fields off one userform and insert
that data into identical fields of another userform. The second userform is
to be filled out at a much later date.

To give you some background, I have designed a userform in Word with 9
textfields. I have included a button on the form which does the following:

1) Extracts the data from each field

2) Concatenates the fields into a continuous string with the carriage
return character as the delimiter.

3) The string is stored in a variable which ultimately gets stored to the
clipboard.



SEE CODE BELOW



Private Sub Copy_Click()



Dim myDO As DataObject

Set myDO = New DataObject

myDO.SetText Acknowledge_Form1.TextBox1.Value & vbCr &
Acknowledge_Form1.TextBox2.Value & vbCr & Acknowledge_Form1.TextBox3.Value &
vbCr & Acknowledge_Form1.TextBox4.Value & vbCr &
Acknowledge_Form1.TextBox5.Value & vbCr & Acknowledge_Form1.TextBox6.Value &
vbCr & Acknowledge_Form1.TextBox7.Value & vbCr &
Acknowledge_Form1.TextBox8.Value & vbCr & Acknowledge_Form1.TextBox9.Value &
vbCr

myDO.PutInClipboard



End Sub



It works great! Here is my question. I have designed yet another form with
identical fields. I am trying to break the continuous string from the
clipboard in the appropriate places so that the correct data gets inserted
into each field. Is there a way of breaking a string using a delimiter (in
this case, the carriage return delimiter)? The mid() function is not useful
unless you know exactly where to break up the string in advance.



Help is welcome.



Thanks!
 
H

Helmut Weber

Hi Ellen,
Is there a way of breaking a string using a delimiter (in
this case, the carriage return delimiter)?

see help for "split"
for Word version later than 97.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top