Thanks for your replies.
I am very interested in any solution though I would much prefer to understand why it is different to write a macro in MSW2010 than MSW2003. Can you explain how I might achieve the result using Find/Replace?
I rolled back to MSW2003 and the old macros all work fine as do new ones I created. I haven't tried to import the old macros into MSW2010 yet but fail to see why I can write them so easily in MSW2003 but the same instructions written to create a macro doesn't do what I typed in the record mode in MSW2010.
I have copied one macro from the 2003 template to show how basic the code is:
Sub Beige_M()
'
' Beige_M Macro
' Macro recorded 14/04/2015 by Mark Calamus
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Mark Calamus "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveUp Unit:=wdLine, Count:=2
Selection.Range.ListFormat.RemoveNumbers NumberType:=wdNumberParagraph
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdLine, Count:=2
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=vbTab
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
Selection.TypeText Text:=vbTab
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Italic = wdToggle
Selection.Font.Color = wdColorDarkYellow
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
End Sub
As I wrote previously All I want to do is cut-n-paste a name and then a time to the lines above, then format the text written below. It seems very simple and I can and have re-written the codes with small changes in MSW2003 and they work pretty much how I want.
To reiterate I think it is the 'find' (CTRL-F) part that is the problem.
Any further help would be appreciated - I really want to upgrade to MSW2010!
Cheers
Mark Calamus
|