Solved

Insert a bookmark after a table in a word document

Posted on 2014-04-10
6
281 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 49

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 49

Expert Comment

by:Rgonzo1971
ID: 39992105
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 49

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

895 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

16 Experts available now in Live!

Get 1:1 Help Now