Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Adam
 
Posts: n/a
Default Data Automation from Excel to Word

Does anyone know how to get cell data (from multiple) cells into a Word
Document (New or a Template) by the click of a form button??
  #2   Report Post  
galimi
 
Posts: n/a
Default

Adam,

The following Excel macro will copy all data from selected cells into a new
Word document

Sub moveToWord()
Set x = CreateObject("Word.Application")
x.Documents.Add
x.Visible = True

For Each cl In Selection

x.Selection.TypeText CStr(cl.Value)
x.Selection.TypeParagraph

Next
End Sub

http://HelpExcel.com

"Adam" wrote:

Does anyone know how to get cell data (from multiple) cells into a Word
Document (New or a Template) by the click of a form button??

  #3   Report Post  
Adam
 
Posts: n/a
Default

So I just put this into the VBA code for a command button, correct?

"galimi" wrote:

Adam,

The following Excel macro will copy all data from selected cells into a new
Word document

Sub moveToWord()
Set x = CreateObject("Word.Application")
x.Documents.Add
x.Visible = True

For Each cl In Selection

x.Selection.TypeText CStr(cl.Value)
x.Selection.TypeParagraph

Next
End Sub

http://HelpExcel.com

"Adam" wrote:

Does anyone know how to get cell data (from multiple) cells into a Word
Document (New or a Template) by the click of a form button??

  #4   Report Post  
galimi
 
Posts: n/a
Default

Forgot to mention that. You can tie this code to a form command button, or
use the code in between Sub and End Sub directly into a Command Button from
the Control Toolbox or a UserForm.

http://HelpExcel.com

"Adam" wrote:

So I just put this into the VBA code for a command button, correct?

"galimi" wrote:

Adam,

The following Excel macro will copy all data from selected cells into a new
Word document

Sub moveToWord()
Set x = CreateObject("Word.Application")
x.Documents.Add
x.Visible = True

For Each cl In Selection

x.Selection.TypeText CStr(cl.Value)
x.Selection.TypeParagraph

Next
End Sub

http://HelpExcel.com

"Adam" wrote:

Does anyone know how to get cell data (from multiple) cells into a Word
Document (New or a Template) by the click of a form button??

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
How do I isolate my Excel server (automation) from other Excel instances? Joseph Geretz Excel Discussion (Misc queries) 5 July 19th 13 03:18 PM
Refreshing Access data in Excel Jimmy G Excel Discussion (Misc queries) 0 December 21st 04 03:53 PM
Word field codes in Excel data file Includetext mranz Excel Discussion (Misc queries) 1 December 7th 04 11:19 PM
Getting specific data from a word document into an excel sheet smintey Excel Worksheet Functions 3 December 7th 04 05:17 PM


All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"