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