Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro help
Message
De
24/07/1998 16:20:42
 
 
À
24/07/1998 11:21:25
Dustin Barlow
Data & Media Technologies, Inc.
Kansas City, Missouri, États-Unis
Information générale
Forum:
Visual Basic
Catégorie:
VBA
Titre:
Divers
Thread ID:
00120943
Message ID:
00121187
Vues:
15
>The easiest way that I've found to figure out what code is needed to do a specific task in Word is to record a macro of yourself doing that specific task and then view the resulting macro (VBA) code and replace the non-dynamic elements with whatever dynamic elements you want to add to the script.
>
>If you're using OLE to control Word from VB, then "most" of the time the VBA scripting code that Word generates can be "cut and pasted" into your VB app.

Good idea.

Selecting all the text and selecting the Search/Replace dialog resulted in the following code:

Selection.WholeStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "orgiginal"
.Replacement.Text = "modified"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll


This should work in vb if you apply it to a Word object.
Guy Barrette, MCSD
============
Blog http://weblogs.asp.net/guybarrette
Microsoft Regional Director, Montreal, Canada www.microsoft.com/rd
MVP, ASP.NET http://mvp.support.microsoft.com/
President, Montreal Visual Studio User Group www.guvsm.net
INETA Regional Rep for Quebec www.ineta.org
UniversalThread Magazine Columnist (.NET Books Review Column) www.utmag.com
Tech Chair French Track, DevTeach 2004 & 2005 www.devteach.com
Business Architect, Microsoft Team - Nurun Inc www.nurun.com
XBox Live Gamer Tag: Slomo QC CA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform