From: Ranjith Kurian on
Hi

i would like to open word file using getopenfilename by using excel macro
and copy the data to excel file.

Sub test()
Dim appWD As Word.Application
Dim appWDS As Word.Document
Set appWD = CreateObject("Word.Application.8")
appWD.Visible = True
filetoopen = Word.Application.GetOpenFilename("All Files (*.*),*.*")
Workbooks.Open filetoopen
end sub
From: thexlguy on

Here you go. This works. It's not exactly like your code, but you get
the idea. The "text to be pasted" should be replaced with text from
your Excel file. Let me know if you need help getting the text from
your excel file via VBA.

Sub PasteIntoWordDoc()

Dim wrd As Object

Set wrd = CreateObject("Word.Application")
wrd.documents.Open "C:\test.doc"
wrd.Visible = True

'MsgBox (wrd.documents.Item(1).Name)

wrd.documents.Item(1).Range(Start:=0, End:=0).Text = "text to be
pasted"
Set wrd = Nothing

End Sub

Thanks,
Mike

'TheXLGuy.com Excel Heat Maps' (http://thexlguy.com)


--
thexlguy
------------------------------------------------------------------------
thexlguy's Profile: http://www.thecodecage.com/forumz/member.php?u=1736
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=196374

http://www.thecodecage.com/forumz