Thanks so much, Greg.
I have managed to get your second example to work with the first so it now just takes the text without the return character.
I have one final question - In some scenarios one or more of my bookmarks from the Source Document might be deleted by the user (e.g. where that section was not relevant for their requirements) is there a way to state that if one of the bookmarks referred to in the code can't be found / doesn't exist then to move onto the next rather than crashing/stopping the macro?
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oTarDoc As Document, oSourceDoc As Document Dim oRng As Word.Range Dim oRngSource As Word.Range Set oSourceDoc = ActiveDocument Set oTarDoc = Documents.Open("C:\Users\herriale\Desktop\New folder\Phase 2\Template (MY.G.PBR) 31.3.15.dotm") With oTarDoc 'box 1 Set oRng = .Bookmarks("PlayerName").Range Set oRngSource = oSourceDoc.Bookmarks("wholename").Range oRngSource.End = oRngSource.End - 1 oRng.Text = oRngSource.Text .Bookmarks.Add "wholename", oRng 'box 2 Set oRng = .Bookmarks("Club").Range Set oRngSource = oSourceDoc.Bookmarks("wholeclub").Range oRngSource.End = oRngSource.End - 1 oRng.Text = oRngSource.Text .Bookmarks.Add "wholeclub", oRng End With lbl_Exit: Exit Sub End Sub




Reply With Quote
