Solved

vb script insert table row before current row

Posted on 2016-08-07
3
36 Views
Last Modified: 2016-08-07
How do I insert a row before the third row of a multi row Microsoft Word Table using VB Script  (not VBA)        

Here is my code and errl
dim tbl
set tbl = wd.ActiveDocument.Tables(1)                        
set newrow = tbl.rows.add(3)

Error:  http://www.screencast.com/t/mV9EUiu03
0
Comment
Question by:maxdbase
  • 2
3 Comments
 
LVL 51

Expert Comment

by:Bill Prew
ID: 41746247
Which of these lines is line 86?

~bp
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 41746264
Try this, the documentation indicates the BeforeRow parm needs to be passed as a Row datatype, not a number.

set newrow = tbl.rows.add(tbl.Rows(3))

Open in new window

~bp
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 41746364
Note that for most things, once the environment is established (Word Application object and/or Word Documentation object etc.,  VBScript and VBA are the same.

(Follow Bill Prew for the actual solution)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now