Converting winword macro to mac

A

arkg14

I was given a winword created macro and it works great on my kids pc,
but I need it to work on my mac. Is there an easy way to convert (I
know nothing about this). I am running Office 2004. It's fairly short
- it involves converting a number set, separated by commas and
enclosed in () to same numbers, separated by dashes and enclosed in 2
sets of { } with 3 numbers in each.

Sub Fix_Instructions()
'
'This is just a down and dirty macro. It finds where the number set
begins and manipulates the text
'You can adjust the sequence of manipulations if you want to
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^# ("
.Replacement.Text = "-"
.Forward = True
End With
Selection.Find.Execute
While WordBasic.EditFindFound() = True
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=2, Extend:=wdExtend
Selection.TypeText Text:="{"
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = ")"
.Replacement.Text = "-"
.Forward = True
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ", "
.Replacement.Text = "-"
.Forward = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeText Text:="}"
Selection.Find.ClearFormatting
With Selection.Find
.Text = "-"
.Forward = False
End With
Selection.Find.Execute
Selection.Find.Execute
Selection.Find.Execute
Selection.TypeText Text:="}{"
Selection.Find.ClearFormatting
With Selection.Find
.Text = "}"
.Replacement.Text = "-"
.Forward = True
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1

Selection.Find.ClearFormatting
With Selection.Find
.Text = "^# ("
.Forward = True
End With
Selection.Find.Execute
Wend
End Sub
 
J

John McGhie

What makes you say that needs any conversion? That compiles just fine in
Word 2004.

I am not sure were the problem is?

Cheers


I was given a winword created macro and it works great on my kids pc,
but I need it to work on my mac. Is there an easy way to convert (I
know nothing about this). I am running Office 2004. It's fairly short
- it involves converting a number set, separated by commas and
enclosed in () to same numbers, separated by dashes and enclosed in 2
sets of { } with 3 numbers in each.

Sub Fix_Instructions()

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top