PDA

View Full Version : Blank form copy



davidboutche
10-02-2008, 02:04 AM
Hello

I've made a word document that consists of three sections. I've made a macro attached to a button that will copy the mid section and paste below itself as many times as necessary for the user.

The problem is, it's copying the already completed table with all it's contents. The user however won't always know he needs a new table until he's completed one.

How do get it to copy the table, but not all the data within it.

The section consists of a table, standard text which I want to keep each time, some yes/no list boxes and field data which I want removed each time.

Any help appreciated

tca_VB
10-02-2008, 08:15 AM
When the table is copied, what are the bookmarks for the data fields and yes/no fields? I've had them be blank or Text8 - depending on how your prior data fields were named.

The button that copies the table could also cycle through the created formfields name or count for the new table and set values to blank. You might also want to cycle through and give these formfields a bookmark name. Make the code scalable for each time the table is copied.

davidboutche
10-02-2008, 08:29 AM
I'm a bit of a novice so you'll have to go slow. The text fields are bookmarked text1 to text 5. These are the ones that i really want the values set to blank on the new pasted text.

Below should be the buttons macro. What do i need to add to get it to blank the values?


Private Sub CommandButton1_Click()
'
' tic Macro
' Macro recorded 30/09/2008 by 1665
'
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst, Count:=1, Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.MoveDown Unit:=wdLine, Count:=9
Selection.Extend
Selection.MoveDown Unit:=wdLine, Count:=8
Selection.Copy
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.PasteAndFormat (wdPasteDefault)
Selection.MoveDown Unit:=wdLine, Count:=1
End Sub
Private Sub addtic_Click()
End Sub

fumei
10-02-2008, 08:57 AM
You would be much better off making a new table(s), with new formfields, as required.

If a "copy" is not the same as the source, it is NOT a "copy".

davidboutche
10-03-2008, 01:45 AM
I think I know where you're coming from, but I really am a newbie and wouldn't know where to start. I only just managed to figure out out to get the copy to function....

how would I do this or is there a guide somewhere i could follow?