Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is it possible in VBA to copy named range data and paste it in to new word document?, I intend using a command button to start the code where for arguments sake Range("A1") will have a name selected from a list which will be the name of the named range, on click of the button copy and paste the named range data (values only!) in to a newly opened word document, it doesnt matter if it is pasted in to the default position (where the cursor starts flashing) when you first open word. Any ideas? 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 .typetext range("whatever").value end with Simon Lloyd wrote: Is it possible in VBA to copy named range data and paste it in to new word document?, I intend using a command button to start the code where for arguments sake Range("A1") will have a name selected from a list which will be the name of the named range, on click of the button copy and paste the named range data (values only!) in to a newly opened word document, it doesnt matter if it is pasted in to the default position (where the cursor starts flashing) when you first open word. Any ideas? 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Aidan thanks for the reply, i tried running the code in a seperat module, and got the error "run time error '438' Object doesn't suppor this property or method" Any ideas why this might be?, the code opened the Word window but n document (no blank page). Regards, Simo -- Simon Lloy ----------------------------------------------------------------------- Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670 View this thread: http://www.excelforum.com/showthread.php?threadid=54902 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks Aidan, worked a treat! 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying a doc from Excel and pasting it into Word. | New Users to Excel | |||
Prevent invalid data when pasting from Word directly onto cell? | Excel Discussion (Misc queries) | |||
copying from word and pasting into excel | Excel Programming | |||
Excel - Word: Problems copying/pasting shapes | Excel Programming | |||
VB automated pasting of Excel range into Word document | Excel Programming |