Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Word / VB6

Posted on 2001-07-23
5
Medium Priority
?
180 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 60 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
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…

879 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