#1   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 217
Default BookMark text change

Hi swje,

I've been playing around with PPT code and made a little bit of progress but
I think it would take me quite a while before I'd be able to give any decent
coding advice.

So, I'd suggest that you ask the experts in the PPT NG, and it might be
helpful if you could tell them a few things:

The version of PowerPoint you're using.
What it is you want to do.
(Including whether what you want is for design mode or presentation mode.)
Why you want to do it - i.e. the purpose of the exercise.

Hope they can help.

Regards.

Ed
"swje" wrote:

Hi Ed,
Thanks for your help. My program can works fine now.
If it's not too much trouble,I want to ask you another question: In word, as
we said above, we can named a bookmark to save some meaningful words, and
check it's change. Is it has any object in PowerPoint can do the same things:
named a ojbect to save text, and can check it's change.

Thanks,
swje


"Ed" wrote:

Hi again,

What about something along these lines ...

In the class modue (MyObject) ...
-----------------------------------------------------------------
Public WithEvents MyApp As Word.Application

Private Sub MyApp_WindowSelectionChange(ByVal Sel As Selection)
Static BMName As String
Static BMText As String

Dim bm As Bookmark
Dim NewBMText as String

If BMName "" Then
NewBMText = ActiveDocument.Bookmarks(BMName).Range.Text
If BMText NewBMText Then
MsgBox BMName & " has changed"
End If
BMName = ""
End If

For Each bm In ActiveDocument.Bookmarks
If Selection.InRange(bm.Range) Then
BMName = bm.Name
BMText = bm.Range.Text
End If
Next
-----------------------------------------------------------------

And in a code module ...
-----------------------------------------------------------------
Dim MyWordObject As New MyObject

Sub Test()
Set MyWordObject.MyApp = Word.Application
End Sub

-----------------------------------------------------------------

It's not without its limitations as it stands - for example, if bookmarked
text is changed but the selection isn't changed afterwards, or if the
insertion point is in a bookmark range when the document opens.

Regards.

Ed

"swje" wrote:

Ed,
Thanks for your post. Your way can work the problem out.
But if there too many bookmarks defined, the efficiency will be not so good,
I want to check it in WindowSelectionChange event, it can get the select
range changed text, but can't get the original range text before change, if
there will be a WindowSelectionClick event and so on, everything will be OK.

Thanks,
swje

"Ed" wrote:

Hi swje,

If you can tell us why you want to know that and what you want to do with
the imformation someone may be able to suggest something suitable.

In the meantime, is something (very basic) like this of any use ...

A macro which you run before editing the document which saves bookmark names
and bookmarked text into a collection, and a macro which you run after the
edit which compares bookmarked text in the document with the corresponding
text that was saved by the first macro.

E.g.

In a module's Declarations section you could have something like this:

Dim BMColl as collection

and then two sub-procedures like this:

Dim BMColl As Collection

Sub Before()

Dim bm As Bookmark

Set BMColl = New Collection

For Each bm In ActiveDocument.Bookmarks
BMColl.Add bm.Range.Text, bm.Name
Next

End Sub

Sub After()
Dim bm As Bookmark

For Each bm In ActiveDocument.Bookmarks

If bm.Range.Text BMColl.Item(bm.Name) Then
MsgBox bm.Name & " has changed"
End If
Next

Set BMColl = Nothing
End Sub

Regards.

Ed
"swje" wrote:

Hi Ed,
Thanks for your post.
My question is I have made some bookmark in a document, when eidt the
document I want code to known where the changed text in a bookmark or not?
Thanks,
swje

"Ed" wrote:

Hi swje,

I don't know if this is what you want but you can turn on the display of
bookmarks.

Up to Word 2003, go to Tools Options View Show, and tick Bookmarks.

In Word 2007, go to Office Button Word Options Advanced Show document
content, and tick "Show bookmarks".

Bookmarks which don't span a range show up as a grey "I" and bookmarks which
do span a range show up as grey square brackets.

Regards.

Ed

"swje" wrote:

Hi,
when eidt a word in document, is there any way to konwn the changed word
inside a bookmark or not ?

Thanks,

swje
2007/8/20

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bookmark Text color change lewchase Microsoft Word Help 1 July 30th 07 08:51 PM
Editing Bookmark Text Robin Microsoft Word Help 1 January 2nd 07 11:41 PM
The Insert Bookmark box shouldnt vanish after adding a bookmark. RogerKni Microsoft Word Help 4 September 26th 06 03:13 PM
Add Bookmark text to a header or footer Striker New Users 2 September 3rd 06 05:16 AM
Copy text in Word = OLE_LINKx Bookmark Tito Harris Page Layout 3 October 28th 05 06:35 AM


All times are GMT +1. The time now is 08:35 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"