Solved

Insert a bookmark after a table in a word document

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

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 50

Expert Comment

by:Rgonzo1971
ID: 39992105
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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 50

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
.NET 2008 VB and C# 6 39
JSON  parse help 7 40
collection output issue 9 38
Import MySQL data into MS Access using VB.Net interface 5 31
Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

828 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