Dynamic Bookmarks with Variables

  • Thread starter Thread starter WordHelp
  • Start date Start date
W

WordHelp

I have a Word 2000 document that is emailed at periodic
times to people in our company. My task is to take that
document and import data into an Access 2000 db. Now,
this .doc does not have bookmarks, fields or any merge
features to begin with. I know that I can insert bookmarks
via Access and pull the data over. But the information I
need can appear anywhere in the .doc. This data has file
extensions and some has a prefix used to identify acct.
numbers. Knowing this, I can specify what Access needs to
look for by pattern matching and string parsing (ie.
leading spaces and punctuation). My question is, can I
dynamically insert bookmarks based on the values that I
assign to string variables? From here I can eliminate
incorrect data through a query and all should be *fine*.
Thanks for any help you can provide.
 
I've discovered that using this in code:

With wdRange.Find
.Text = Trim("(<Q??????)")
.MatchWildcards = True
.Execute
End With

to identify acct.numbers works for finding these
instances. But I also need to find the filenames and their
extensions within the same document. For example:

AnyFile.exe

There can be one or more different filenames, but I have
four different extensions to use in the search. The
filenames can also be of any length. I've tried using:

Sub GetFile()

Dim wdRange As Range
Dim myFileName
Dim strWildcard As String


Set wdRange = ActiveDocument.Content
strWildcard = "([0-9*A-z])" & ".exe>"

With wdRange.Find

.MatchWildcards = True
.Text = strWildcard
.Execute

End With

But I can't seem to get Word to return the filename, only
the string value ---> ([0-9*A-z]).exe>

Any suggestions?
 
Usually, you can activate the Word.Application and then do
a series of pattern matching techniques. Someone here
should know more specifically which you can use.
 
Back
Top