I am creating a macro that copies data from excel into word. I can't get the macro to insert a page break after I just copied the range of cells into word. I get the following error
Object doesn't support this property or method.
I am guessing this happens because the copied data in Word is still highlighted and I need to get a cursor at the bottom of the new copied date before I try to insert a page break.
How do I do this?
This is a section of the code that is not working - actually the last line of the code but I thought I should show you right before as well:
Range("A1:F25").Select
Selection.Copy
appWD.Documents.Add
appWD.Selection.PasteSpecial Link:=True, DataType:=wdPasteEnhancedMetafile
DoEvents
appWD.InsertBreak Type:=wdPageBreak
Try this instead:
With appWD.Selection
.Collapse Direction:=0
.InsertBreak Type:=7
End With
Source: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.selection.insertbreak(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.selection.collapse(v=office.14).aspx
http://www.utteraccess.com/forum/Error-9118-protect-Docu-t1123894.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With