Solved

vb script insert table row before current row

Posted on 2016-08-07
3
41 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 52

Expert Comment

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

~bp
0
 
LVL 52

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vbscript 8 78
Modification on userform and column K 47 37
Add and format columns in vb6 7 42
recent docs in word and excel 3 38
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…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

937 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

15 Experts available now in Live!

Get 1:1 Help Now