Hey guys,
This is a sub in word that I call from in Excel. It works perfectly when i step through it but when I run it throws an error when doing the pasteandformat command. Any help would be much appreciated!![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Code : Sub titles()
For i = 2 To 10
ActiveDocument.Bookmarks(i).Select
Selection.MoveDown Unit:=wdLine, Count:=12
Selection.MoveDown Unit:=wdParagraph, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.Copy
Selection.MoveUp Unit:=wdLine, Count:=13
Selection.PasteAndFormat (wdFormatPlainText)
Next i
ActiveDocument.Bookmarks(1).Select
Selection.TypeText (Date)
End Sub
Error
Run-time error '4198':
Command failed
This is a sub in word that I call from in Excel. It works perfectly when i step through it but when I run it throws an error when doing the pasteandformat command. Any help would be much appreciated!
Code : Sub titles()
For i = 2 To 10
ActiveDocument.Bookmarks(i).Select
Selection.MoveDown Unit:=wdLine, Count:=12
Selection.MoveDown Unit:=wdParagraph, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.Copy
Selection.MoveUp Unit:=wdLine, Count:=13
Selection.PasteAndFormat (wdFormatPlainText)
Next i
ActiveDocument.Bookmarks(1).Select
Selection.TypeText (Date)
End Sub
Error
Run-time error '4198':
Command failed