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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XL-->Worrd Copy/Paste Range Runtime Error 13

Status
Not open for further replies.

nickadeemus2002

Programmer
Feb 27, 2004
9
US
Good Morning all. I keep getting a type mismatch error with the following code:

Public Sub SendToWord()
Dim CAP As Range
Dim myWord As Word.Application
Set CAP = Sheets("InitialAssessments").UsedRange
CAP.Copy
Set myWord = New Word.Application
With myWord
.Visible = True
.Activate
myWord.Documents.Open _
Filename:="C:\Documents and Settings\chrisv\Desktop\HBC2\Report Document\HBC Reporting Document.doc"
With Selection
myWord.ActiveDocument.Bookmarks("InitialAssessments").Select
.Item("InitialAssessments").Range.Text = CAP.PasteSpecial <-----PROBLEM WITH THIS LINE
End With
End With
End Sub

I am trying to copy a used range in Excel and copy it at the Initial Assessments Bookmark in Word.

Suggestions??

Thanks for the help
 
Try this:
myWord.ActiveDocument.Bookmarks("InitialAssessments").Range.PasteSpecial
instead of this:
With Selection
myWord.ActiveDocument.Bookmarks("InitialAssessments").Select
.Item("InitialAssessments").Range.Text =
CAP.PasteSpecial <-----PROBLEM WITH THIS LINE
End With

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top