|
-
Jul 30th, 2006, 11:49 AM
#1
Thread Starter
Lively Member
VBA WORD: readings words setting bookmarks ?
Hello, this is my very first VB program and i have a word document that contains certan pre-marked items, ie i put these a "<:" ":>" symbols around the items, and i'm trying to create a program that will recognize these symbols and automatically create a bookmark with what is in between these symbols.
The code seems to put the correct name in the bookmark list, but when i try to manually create a hyperlink to that bookmark, it doesn't jump to that bookmark location as expected and i realize that i probably need to use some special word(method) to capture the symbol and word's actual location and then apply the bookmark to that exact location does that sound like what i need please?
Any pointers would be appreciated! Thanks very much!
Sub ReadWord
Dim SingleWord As String
Dim pre3 As String
Dim pre2 As String
Dim pre1 As String
For Each aword In ActiveDocument.Words
' Range wr = aword.Item
SingleWord = Trim(LCase(aword))
pre3 = pre2
pre2 = pre1
pre1 = aword
'MsgBox (" 3/" + pre3 + " 2/" + pre2 + " 1/" + pre1)
If pre3 = "<:" And pre1 = ":>" Then
'ActiveDocument.Bookmarks.Add pre2
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:=pre2
End With
End If
Next aword
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|