Solved

Insert a bookmark after a table in a word document

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

777 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