Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

Bookmark

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ulf Nilsson - 11 Apr 2005 12:07 GMT
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
Helmut Weber - 11 Apr 2005 12:34 GMT
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
Ulf Nilsson - 11 Apr 2005 12:46 GMT
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,
[quoted text clipped - 25 lines]
>
>.
Ulf Nilsson - 11 Apr 2005 12:55 GMT
Hi,
I just found out that I had more than one bookmark in
that paragraph. Your code works just fine!

/ Ulf

>-----Original Message-----
>Hi,
[quoted text clipped - 46 lines]
>>
>.
Helmut Weber - 11 Apr 2005 13:06 GMT
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
Ulf Nilsson - 14 Apr 2005 08:13 GMT
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,
[quoted text clipped - 19 lines]
>
>.
Helmut Weber - 14 Apr 2005 11:55 GMT
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/
Ulf Nilsson - 14 Apr 2005 14:11 GMT
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,
[quoted text clipped - 23 lines]
>
>.
Helmut Weber - 14 Apr 2005 20:45 GMT
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.
[quoted text clipped - 44 lines]
>>
>>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.