View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] aidan.heritage@virgin.net is offline
external usenet poster
 
Posts: 244
Default Copying Cell data and pasting into word document?

Sorry about that - I'm used to working with open instances of Word, and
loading templates, and then using one cell at a time with bookmarks in
the template - revised and TESTED code is

Dim appwd As Object
On Error GoTo notloaded
Set appwd = GetObject(, "Word.Application")
notloaded:
If Err.Number = 429 Then
Set appwd = CreateObject("Word.Application")
End If
appwd.Visible = True
On Error GoTo 0
With appwd
'.documents.Add
Range("A1:B2").Copy 'replace A1:B2 with the range you want!
.Selection.Paste
End With


Simon Lloyd wrote:
Hi Aidan thanks for the reply, i tried running the code in a seperate
module, and got the error "run time error '438' Object doesn't support
this property or method"

Any ideas why this might be?, the code opened the Word window but no
document (no blank page).

Regards,
Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=549029