Hi. The key point is: "locate data "
We need (or rather YOU need) to state where that is, i.e locate the data. Like I stated in the Office forum with your original post, this should not be difficult, what drives it is the logic.
And what will drive the logic is getting the data.
If the address is in a bookmark, this is real simple.
If the address is in a field, this is real simple.
If the address is in a defined cell in a table, this is real simple.
So..........
"There is a section within the Word doc that contains the address of the sender. "
How can we find that "section"? Is it a real Word section, or is it a "section" that YOU think of as a section? To Word, a Section is a defined range of the document, between two section breaks. NO other definition. A Section is between section breaks.
I suspect your document is not structured this way, and that is OK, but we need to know. WHERE is that address? If it is text (like other text), then we need to be to find it. Perhaps search for it. However, if the address text is ALWAYS - and I mean always - in the same location, then this is can be helpful.
1. you can get the address information by looking at that location.
2. you can bookmark that location, and then get the information from the bookmark (this is EASY).
Once you get the address, saving to different location is straightforward. Something like:
Code:
Dim strAddress As String
strAddress = [i]address information[/i]
[COLOR=red]' something like
' strAddress = ActiveDocument.Bookmarks("Address"). _
Range.Text[/color red]
If InStr(strAddress, "abcdef") > 0 Then
ActiveDocument.SaveAs _
FileName:="\\FS01\DOCS\SENDER2" & _
[i]YourFileName[/i]
Else
ActiveDocument.SaveAs _
FileName:="\\FS01\DOCS\SENDER1" & _
[i]YourFileName[/i]
End if
In any case, once you GET the address information, it is easy to check if it contains a specific string (say abcdef), and if it does, save the file at X; if it does NOT, save the file at Y.
Gerry