Solved

Word / VB6

Posted on 2001-07-23
5
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

749 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