PDA

View Full Version : Bookmarking Bug in Word 2003



murphy84
08-30-2007, 07:33 AM
Hi,

This isn't exactly a VBA question but relates to Word and ties in with a VBA project I'm working on. I'll picture the scenario.

Let's say you have a large table that spans several pages and this contains several hundred bookmarks. A couple of the bookmarks overlap each other. One of the bookmarks is used to mark a section of the document that I want to copy and reuse multiple times (I'll refer to this as bookmark A). Then there is another bookmark that has the same starting position as the first but finishes within the bookmark that is used as the multiple section placer (I'll refer to this as bookmark B).

Now, I have a routine that copies the bookmark A - x number of times. My problem is this: when copying bookmark A it appears to duplicate the top row and place bookmark B inside it.

Has anyone else come across this bug before? If so, how did you get around it so that bookmark A will only copy exactly the number of rows that it spans and no more?

I'm wondering if I've found a bug in word. If it helps I'm using Word 2003.

Thanks in advance.

Anne Troy
08-30-2007, 03:36 PM
Hm. Don't use Bookmarks for "copying". Instead, create an Autotext entry and run the autotext entry X number of times. The autotext entry should NOT contain the bookmark, right?

murphy84
08-31-2007, 12:25 AM
Hm. Don't use Bookmarks for "copying". Instead, create an Autotext entry and run the autotext entry X number of times. The autotext entry should NOT contain the bookmark, right?

The copied areas need to contain cells, bookmarks and text - the formatting must be exact also. As far as i know Autotext doesn't support that. There doesn't appear to be a way of getting round it without using bookmarks.

Anne Troy
08-31-2007, 06:00 AM
As far as i know Autotext doesn't support that.

Not true. You just need to make sure you also copy the paragraph that follows the stuff you want included.

fumei
08-31-2007, 11:52 AM
Anne is quite correct, AutoText does include format information.

Technically speaking, you need to make sure you include the paragraph mark. Format information is held by the paragraph mark.

As for your copying issues, I am not completely understanding them. First of all, HOW are you copying the bookmarks. If you are copying the bookmarks themselves....don't do that (as Anne mentions). However, there is nothing wrong with copying bookmark contents.

If it is the contents of the bookmarks you want to copy, then copy the bookmark ranges.

I don't know if this will help, but see the demo doc attached. Click "Test Bookmarks" on the menu bar.

Bookmark BM_A bookmarks the first row of the table. Bookmark BM_B bookmarks the second cell in int eh first row. In other words, BM_B is within BM_A - just like you mention.

The procedure fired by Test Bookmarks copies the BM_A bookmark as a range.

Notice it does NOT copy the nested bookmark BM_B, although of course it does copy the text (as that text is in the range of BM_A.

The point is if you are selecting the bookmarks, then copying them, this is not a good idea.