Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open Word Document from Excel

1 view
Skip to first unread message

carmen

unread,
Nov 29, 2007, 11:07:47 AM11/29/07
to
Hi!
I have some information in an excel sheet that I want to copy onto a
word Document.
Could anybody help me?

First problem: open the document. Would the following be correct? Open
"path+file name" For ? As 1
Second problem: how do I copy information stored in an excel sheet to
a word file? and this in a certain row?

I would be very thankful for any help you could offer me!
Carmen

G-Money

unread,
Nov 30, 2007, 12:13:52 PM11/30/07
to
Below is a snippet of code I have used:

Sub PasteFromExcelToWord()
Dim MyDataObj As New DataObject
Dim myText

myText = Cells(1,1) & Chr(10) & Cells(1,2)

MyDataObj.SetText myText
MyDataObj.PutInClipboard

'Paste into a new Word document
Dim oWord As Object
Dim oDoc As Object
Set oWord = CreateObject("word.application")
Set oDoc = oWord.Documents.Add
oWord.Selection.Paste
oWord.Visible = True
End Sub

0 new messages