Solved

Insert a bookmark after a table in a word document

Posted on 2014-04-10
6
277 Views
Last Modified: 2014-04-10
Here is what i am doing:
Dim objWord as new word.application
Dim objDoc as word.document = objWord.documents.open("C:\System.docx")
Dim objTable as  word.table = objDoc.tables.Add(objDoc.bookmarks("start").range,4,6)

So i have a starting point bookmark "start" already on the document, after i create the first table there. I would like to add a new bookmark on the next line directly after the table.
0
Comment
Question by:Basicfarmer
  • 3
  • 3
6 Comments
 
LVL 48

Expert Comment

by:Rgonzo1971
ID: 39992047
Hi,

pls try

objTable.Select
objWord.Selection.MoveDown Unit:=wdLine, Count:=1

Open in new window

Regards
0
 

Author Comment

by:Basicfarmer
ID: 39992094
It does not like "wdLine". I tried using vbNewLine as that was an option. It also does not like "Word.Line".
screen shot
0
 
LVL 48

Expert Comment

by:Rgonzo1971
ID: 39992105
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:Basicfarmer
ID: 39992140
Ok, using the 5 worked. I dont know why word rejected its own wdLine. So now i have the table selected. I can see that maybe I dont need any bookmarks at all. How do i make the selection this new line I am on with the cursor so i can add another table there. I am adding the first table like so:
objDoc.select
objTable = objDoc.tables.add(oword.selection.range, rowCount, ColumnCount)

Open in new window

0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39992178
Hi,
let's try
objTable = objDoc.tables.add(oword.selection.range, rowCount, ColumnCount)
objTable.Select
oword.Selection.MoveDown Unit:=5, Count:=1
oword.Selection.TypeParagraph
objTable1 = objDoc.tables.add(oword.selection.range, rowCount, ColumnCount)

Open in new window

Regards
0
 

Author Closing Comment

by:Basicfarmer
ID: 39992198
Beautiful, the oword.selection.typeparagraph did the trick. Now since i see that i may not need any bookmarks for what I am doing I am going to post another question, watch for it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 5 124
ASP.net GridView with totals at the bottom 2 24
Calling stored proc in EDMX 11 19
XML & .net 5 21
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

744 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

10 Experts available now in Live!

Get 1:1 Help Now