Solved

Word / VB6

Posted on 2001-07-23
5
171 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

623 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