jtukes
11-04-2013, 08:07 AM
Hi All,
I am trying to figure out how to insert a user specified amount "N" number of Tables, one after the other in a Word Doc using VBA. Basically, I have to duplicate the same Table multiple times depending on how many times the process is run. I tried using a copy/paste method (see below) and that didnt seem to work, so I am wondering if there is any other way to have the number of Tables inserted be dependent on a user input? Any help would be greatly appreciated.
Thanks,
jtukes
If UserForm1.ufPhases.Value > 0 Then ' ufPhases is a Textbox
ThisDocument.Tables(9).Select
Selection.Copy
For q = 1 To UserForm1.ufPhases.Value
Selection.EndKey Unit:=wdStory
If Selection.Next(wdCharacter, -1) <> Chr(13) Then Selection.TypeParagraph
Selection.Paste
Next
End If
I am trying to figure out how to insert a user specified amount "N" number of Tables, one after the other in a Word Doc using VBA. Basically, I have to duplicate the same Table multiple times depending on how many times the process is run. I tried using a copy/paste method (see below) and that didnt seem to work, so I am wondering if there is any other way to have the number of Tables inserted be dependent on a user input? Any help would be greatly appreciated.
Thanks,
jtukes
If UserForm1.ufPhases.Value > 0 Then ' ufPhases is a Textbox
ThisDocument.Tables(9).Select
Selection.Copy
For q = 1 To UserForm1.ufPhases.Value
Selection.EndKey Unit:=wdStory
If Selection.Next(wdCharacter, -1) <> Chr(13) Then Selection.TypeParagraph
Selection.Paste
Next
End If