Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert a bookmark after a table in a word document

Posted on 2014-04-10
6
Medium Priority
?
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 52

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 52

Expert Comment

by:Rgonzo1971
ID: 39992105
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

722 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