Solved

Word / VB6

Posted on 2001-07-23
5
164 Views
Last Modified: 2010-05-02
Hi!

Here is what I wanna do:

Have a couple document.. and giving the choice to the user of my program to send it to a customer.

Each document will containt some anchor (For Name, Address, phone, fax) but won't necessaraly contain them all..

So my question.. is :  is it possible to loop through all possible anchor and set only those found?

If yes, how?
if no, what other alternative should I look for?
0
Comment
Question by:higijj
  • 4
5 Comments
 

Accepted Solution

by:
BBaron earned 30 total points
ID: 6311561
how about using the find and replace for every anchor? or possibly have all the anchors in an array of strings and loop through the array setting the find string as the anchor to find?. ie

for intcount=0 to arraycount-1

If find <> "" Then
 myWordApp.Selection.find.ClearFormatting
    myWordApp.Selection.find.Replacement.ClearFormatting
    With myWordApp.Selection.find
        .Text = find
        .Replacement.Text = repl
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    myWordApp.Selection.find.Execute Replace:=wdReplaceAll
endif

next intcount

obviously youll need to set the replace string somewhere though?(repl)
0
 
LVL 2

Author Comment

by:higijj
ID: 6312136
but the find / replace function will find an array ?!
Thanks.
0
 
LVL 2

Author Comment

by:higijj
ID: 6312146
d'oh!

in my previous comment, array meant to be bookmark ;-)


Cuz I just opened my word, paste some text, add a bookmark

and when I did find/replace and looking for my bookmark, it says it found nothing ;-/
0
 
LVL 2

Author Comment

by:higijj
ID: 6312155
and what are the clearformatting for ?
0
 
LVL 2

Author Comment

by:higijj
ID: 6313592
I tried the above.. and it doesn't even go inside the if find <> "" statement..

hehe..
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now