Solved

Inserting pagebreak after bookmark

Posted on 2004-04-07
2
242 Views
Last Modified: 2010-05-02
Hi All,
I am trying to insert a pagebreak after a bookmark but the bookmark gets deleted when i do that...

The following is the code I am trying..

bkName = objBookMark.Name
Set bkRange = objDocNew.BookmarksobjBookMark.Name).Range
bkRange.Text = " "
objDocNew.Bookmarks.Add Name:=bkName, Range:=bkRange
objDocNew.Bookmarks(bkName).Range.Collapse direction:=wdCollapseEnd
objDocNew.Bookmarks(bkName).Range.InsertBreak Type:=wdPageBreak


Help is appreciated...
Cheers
Ramya
0
Comment
Question by:ramyaj
[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
2 Comments
 
LVL 11

Accepted Solution

by:
Steiner earned 50 total points
ID: 10781263
Try using Selection instead:
Sub Test()
    ActiveDocument.Bookmarks("breakhere").Range.Select
    Selection.Collapse wdCollapseEnd
    Selection.InsertBreak wdPageBreak
End Sub
0
 

Author Comment

by:ramyaj
ID: 10781471
Its working fine now...Thanks for the help Steiner...

Regards
Ramya
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month4 days, 21 hours left to enroll

636 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