Solved

vb script insert table row before current row

Posted on 2016-08-07
3
47 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 53

Expert Comment

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

~bp
0
 
LVL 53

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

856 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