Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasting Excel into Word - will not quite work

Status
Not open for further replies.

Novice1975

Technical User
Sep 16, 2008
1
GB
Hello

This is driving me nuts. Please help. I am trying to paste a range from an Excel sheet into a word document, but it keeps crashing when the paste should happen. Here is the relevant code:

"Dim wrd As Word.Application
Dim myDoc As Word.Document
Dim myExcelDoc As Excel.Workbook
Set myExcelDoc = ActiveWorkbook

myExcelDoc.Activate
wksPostcodeCalcs.Activate
ActiveSheet.Range("tblSocioGroupsDefs").Select
Selection.Copy

Set wrd = CreateObject("Word.Application")
wrd.Visible = True
Set myDoc = wrd.Documents.Open(strLetterPath)
myDoc.Activate

ActiveDocument.Range.Bookmarks("tblSocioGroupsDefs").Range.PasteSpecial Link:=False, DataType:=9 'wdPasteEnhancedMetafile"

The error says "the requested member of the selection does not exist".

Please help.

Thanks
 
I assume the variable, strLetterPath, is actually set and its value is a valid path?

If that's the case, does the Word doc actually have a bookmark set to "tblSocioGroupsDefs"?

_________________
Bob Rashkin
 
[!]myDoc[/!].Bookmarks("tblSocioGroupsDefs").Range.PasteSpecial Link:=False, DataType:=9 'wdPasteEnhancedMetafile"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top