Solved

Word / VB6

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 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

18 Experts available now in Live!

Get 1:1 Help Now