Repeating Form

R

Razz

Can anyone help with coding that will make a form repeat.
I have a form that enters expenses and I would like this form to repeat.
When data is entered on the first form, I need it to enter that text in the
document and so on, wile selecting the Next button. I have included a
Finish button to end the repeat.

Thanks in advance.
 
C

Cindy M -WordMVP-

Hi Razz,

It's not quite clear what you have/want. Do you have a UserForm? Or form
fields in a document?

If a UserForm (that's the impression I get), then you click a button
("Next"?) and the data is transferred into the document? And then what, more
exactly, do you need to have happen that you can't figure out?

Oh, and which version of Word are we dealing with?
Can anyone help with coding that will make a form repeat.
I have a form that enters expenses and I would like this form to repeat.
When data is entered on the first form, I need it to enter that text in the
document and so on, wile selecting the Next button. I have included a
Finish button to end the repeat.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
R

Razz

Hello

Im using Word 2002 and VBA UserForms.
I have created a Userform named frmExpenses. When Next is selected on
frmExpenses, i need that data to transfer into the document and then replay
the same userform (frmExpenses) as a new empty form ready for fill in.

It should continue to repeat frmExpenses until cmdFinish is selected.

Is this possible? I cant find much info on repeating vba forms.
Thank you.
 
D

Doug Robbins

Where are the second and subsequent sets of data intended to go? Into the
original document or is a new document to be created each time?

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
R

Razz

Im placing the data into a table of the original document. My code
currently looks like this:
With Me
ActiveDocument.tables(2).Cell(Row:=2, Column:=1).Select
Selection.TypeText (.txtDate.Text)
ActiveDocument.tables(2).Cell(Row:=2, Column:=2).Select
Selection.TypeText (.txtFunction.Text)
ActiveDocument.tables(2).Cell(Row:=2, Column:=3).Select
Selection.TypeText (.txtClients.Text)
End With
This works fine if I didnt it need the same frm to continue repeating upon
next.
Thank you :)

Im hitting reply to group so i hope it works this time.
 
D

Doug Robbins

Hi Razz

The following will add a newrow to the table each time that the command is
executing and will populate the cells in that row with the data from the
userform

Dim newrow As Row
Set newrow = ActiveDocument.Tables(2).Rows.Add
newrow.Cells(1).Range.InsertBefore txtDate
newrow.Cells(2).Range.InsertBefore txtFunction
newrow.Cells(3).Range.InsertBefore txtClients

If you want to clear the data from the form each time, add the following to
it

txtDate=""
txtFunction=""
txtClients=""

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
R

Razz

Thanks Doug, This works well.

I take it creating a repeating entry form is not so black & white in vba?
 

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