Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help in converting the following WordBasic macro to vba

Status
Not open for further replies.

sonname

Programmer
May 18, 2001
115
US
Hi,
The following wordBasic macro does not work in Word 2003 and I need to convert the code over. Here is the code, can anyone translate the following?

WordBasic.EditFind Find:="W L O Pt G FA"
While WordBasic.EditFindFound()
WordBasic.StartOfLine
WordBasic.FormatTabs Position:="9 pi", Align:=2, Leader:=0, set:=1
WordBasic.JustifyPara
WordBasic.LineDown 1
WordBasic.RepeatFind
Wend

Thanks in advance

 
It should work in Word 2003. It should find each occurrence of that odd string of text and format the paragraph containing it.

What does happen?

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
The thing is that it doesn't work in Word 2003/SP3. It doesn't even find that text. It will not go into the EditFindFound(). I have had to re-write some other macros to vba for it to be able to do these kind of searches. Could there be some kind of compatability switch that I am missing in Word 2003? This all works in Word 2000.
 
As a possible starting point to having your code in VBA, rather than WordBasic...
Code:
Dim r As Range
Set r = ActiveDocument.Range
With r.Find
  .Text = "W L O Pt G FA"
  Do While .Execute(Forward:=True) = True
     With r
       .Expand unit:=wdParagraph
       .Paragraphs.Format.TabStops.Add _
           Position:=InchesToPoints(2), _
           Alignment:=wdAlignTabCenter
       .ParagraphFormat.Alignment = wdAlignParagraphJustify
       .Collapse 0
     End With
  Loop
End With

This may not be fully what you want to do, but it may help to get you going.




faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top