Hi,
Each paragraph in my document is a bookmark:
Paragraph 1 = bm1
Paragraph 2 = bm2
Paragraph 3 = bm3
...

The user can delete paragraph. This mean that paragraph
numer 4 not necessarily means bm4. It could be bm2.

When I click a button, I want the macro to show me in
which bookmark I clicked in and show a messagebox that
correspond with that bookmark. How is this done?

/ Ulf

Re: Bookmark by Helmut

Helmut
Mon Apr 11 06:34:20 CDT 2005

Hi Ulf,

> show a messagebox that correspond with that bookmark.

???

With Selection.Bookmarks
If .Count = 1 Then
MsgBox .Item(1).Name
End If
If .Count = 0 Then MsgBox "no bookmark"
If .Count > 1 Then
MsgBox "Don't know what to do"
End If
End With

Bookmarks can include or overlap other bookmarks,
which can hardly be handled all.

And you might want to collapse
the selection beforehand.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000




Re: Bookmark by Ulf

Ulf
Mon Apr 11 06:46:00 CDT 2005

Hi,
Thanks for the code. Your solution works fine if the
bookmark is in that paragraph, but does not work in this
example:

[Bookmark bm1 starts]Some text comes here.
[empty paragraph]
[empty paragraph]
[Bookmark bm1 ends]
[Bookmark bm2 starts]Some other text...

If the cursor is somewhre in an empty paragraph, the
macro does not find the right bookmark.

Any suggestion?

/ Ulf


>-----Original Message-----
>Hi Ulf,
>
>> show a messagebox that correspond with that bookmark.
>
>???
>
>With Selection.Bookmarks
> If .Count = 1 Then
> MsgBox .Item(1).Name
> End If
> If .Count = 0 Then MsgBox "no bookmark"
> If .Count > 1 Then
> MsgBox "Don't know what to do"
> End If
>End With
>
>Bookmarks can include or overlap other bookmarks,
>which can hardly be handled all.
>
>And you might want to collapse
>the selection beforehand.
>
>Greetings from Bavaria, Germany
>Helmut Weber, MVP
>"red.sys" & chr(64) & "t-online.de"
>Word 2002, Windows 2000
>
>
>
>.
>

Re: Bookmark by Ulf

Ulf
Mon Apr 11 06:55:42 CDT 2005

Hi,
I just found out that I had more than one bookmark in
that paragraph. Your code works just fine!

/ Ulf


>-----Original Message-----
>Hi,
>Thanks for the code. Your solution works fine if the
>bookmark is in that paragraph, but does not work in this
>example:
>
>[Bookmark bm1 starts]Some text comes here.
>[empty paragraph]
>[empty paragraph]
>[Bookmark bm1 ends]
>[Bookmark bm2 starts]Some other text...
>
>If the cursor is somewhre in an empty paragraph, the
>macro does not find the right bookmark.
>
>Any suggestion?
>
>/ Ulf
>
>
>>-----Original Message-----
>>Hi Ulf,
>>
>>> show a messagebox that correspond with that bookmark.
>>
>>???
>>
>>With Selection.Bookmarks
>> If .Count = 1 Then
>> MsgBox .Item(1).Name
>> End If
>> If .Count = 0 Then MsgBox "no bookmark"
>> If .Count > 1 Then
>> MsgBox "Don't know what to do"
>> End If
>>End With
>>
>>Bookmarks can include or overlap other bookmarks,
>>which can hardly be handled all.
>>
>>And you might want to collapse
>>the selection beforehand.
>>
>>Greetings from Bavaria, Germany
>>Helmut Weber, MVP
>>"red.sys" & chr(64) & "t-online.de"
>>Word 2002, Windows 2000
>>
>>
>>
>>.
>>
>.
>

Re: Bookmark by Helmut

Helmut
Mon Apr 11 07:06:48 CDT 2005

Hi Ulf,

hmm, I wonder.

It shouldn't matter whether a bookmark includes
one or more empty paragraphs. However,
if you want to have always, let's say,
Mark4 to inlude Paragraph 4 and nothing but
paragraph 4, you probably have to rearrange
bookmarks before running the macro.
Besides that, It's difficult for me to
imagine what such bookmarks could be good for.

And, are you quite sure, you can exclude
nested or overlapping bookmarks?

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000




Re: Bookmark by Ulf

Ulf
Thu Apr 14 02:13:19 CDT 2005

Hi,
I'm using this together with the field {MACROBUTTON}.
When a person doubble-click on a paragraph, the macro
checks the bookmark:

Private Sub UserForm_Initialize()
Select Case Selection.Bookmarks.Item(1).Name
Case "bm1"
'Fills a textbox with text that corresponds with bm1
Case "bm2"
'Fills a textbox with text that corresponds with bm2
Case Else
'Message that something is wrong
End Select
End Sub

I used buttons before, but they did not always work out
fine. The advantage with buttons is that the user gets a
change in the cursor to an arrow and a question mark. Can
this be done with {MACROBUTTON}?

/ Ulf




>-----Original Message-----
>Hi Ulf,
>
>hmm, I wonder.
>
>It shouldn't matter whether a bookmark includes
>one or more empty paragraphs. However,
>if you want to have always, let's say,
>Mark4 to inlude Paragraph 4 and nothing but
>paragraph 4, you probably have to rearrange
>bookmarks before running the macro.
>Besides that, It's difficult for me to
>imagine what such bookmarks could be good for.
>
>And, are you quite sure, you can exclude
>nested or overlapping bookmarks?
>
>Greetings from Bavaria, Germany
>Helmut Weber, MVP
>"red.sys" & chr(64) & "t-online.de"
>Word 2002, Windows 2000
>
>
>
>.
>

Re: Bookmark by Helmut

Helmut
Thu Apr 14 05:55:58 CDT 2005

Hi Ulf,

>When a person doubble-click on a paragraph
You can doubleclick in a paragraph, which selects a word
in most cases, but doubleclick on a paragraph???

If you use { MACROBUTTON ...}
and the macrobutton is not included in a bookmark,
you get an error, as the selection would be on
the macrobutton, when you doubleclick it.

And what this has to do with a userform,
I don't understand at all.

What is it, that you want to achieve?

Every comment from every co-reader most welcome.

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/


Re: Bookmark by Ulf

Ulf
Thu Apr 14 08:11:58 CDT 2005

Hi again,
Everything works fine for me.

We have a document that users need instructions on how to
fill-in. For example:

If a user doubble-clicks on the following paragraph

1. Your name:

a userform pops up saying: "Please type your full name."

The reason why I use a userform instead of messsage box
is that sometimes the user needs to copy the information.
Therefore is a copy-button in the userform.

Is there a way to change the cursor to a question mark
when users put it on the field?

/ Ulf

>-----Original Message-----
>Hi Ulf,
>
>>When a person doubble-click on a paragraph
>You can doubleclick in a paragraph, which selects a word
>in most cases, but doubleclick on a paragraph???
>
>If you use { MACROBUTTON ...}
>and the macrobutton is not included in a bookmark,
>you get an error, as the selection would be on
>the macrobutton, when you doubleclick it.
>
>And what this has to do with a userform,
>I don't understand at all.
>
>What is it, that you want to achieve?
>
>Every comment from every co-reader most welcome.
>
>Greetings from Bavaria, Germany
>
>Helmut Weber, MVP
>"red.sys" & chr(64) & "t-online.de"
>Word XP, Win 98
>http://word.mvps.org/
>
>.
>

Re: Bookmark by Helmut

Helmut
Thu Apr 14 14:45:35 CDT 2005

Hi Ulf,

just for courtesy, to let you know that I am reading,
that's beyond my knowledge.
Though it must be possible.
If I search my local drives for *.cur,
I get 140 hits. But no question mark.

Sorry.

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/




>Hi again,
>Everything works fine for me.
>
>We have a document that users need instructions on how to
>fill-in. For example:
>
>If a user doubble-clicks on the following paragraph
>
>1. Your name:
>
> a userform pops up saying: "Please type your full name."
>
>The reason why I use a userform instead of messsage box
>is that sometimes the user needs to copy the information.
>Therefore is a copy-button in the userform.
>
>Is there a way to change the cursor to a question mark
>when users put it on the field?
>
>/ Ulf
>
>>-----Original Message-----
>>Hi Ulf,
>>
>>>When a person doubble-click on a paragraph
>>You can doubleclick in a paragraph, which selects a word
>>in most cases, but doubleclick on a paragraph???
>>
>>If you use { MACROBUTTON ...}
>>and the macrobutton is not included in a bookmark,
>>you get an error, as the selection would be on
>>the macrobutton, when you doubleclick it.
>>
>>And what this has to do with a userform,
>>I don't understand at all.
>>
>>What is it, that you want to achieve?
>>
>>Every comment from every co-reader most welcome.
>>
>>Greetings from Bavaria, Germany
>>
>>Helmut Weber, MVP
>>"red.sys" & chr(64) & "t-online.de"
>>Word XP, Win 98
>>http://word.mvps.org/
>>
>>.
>>