ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing excel info into MS Word (https://www.excelbanter.com/excel-programming/429460-writing-excel-info-into-ms-word.html)

Steve

Writing excel info into MS Word
 
Hi

I need to write out information from cells in Excel into MS Word.

a) Can this be done
b) Can it be done without having MS Word oopen
c) Do I need to have MS Word set up a particular way

If there are some examples somewhere that would be great.

Many Thanks

Steve

Steve

Writing excel info into MS Word
 
Thanks

What if the Word document is a form and I need to place the cell info in a
particular place?




"Gary''s Student" wrote:

http://www.erlandsendata.no/english/...olecontrolword
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi

I need to write out information from cells in Excel into MS Word.

a) Can this be done
b) Can it be done without having MS Word oopen
c) Do I need to have MS Word set up a particular way

If there are some examples somewhere that would be great.

Many Thanks

Steve


Gary''s Student

Writing excel info into MS Word
 
We are coming to the fun part!

Commanding Word means understanding Word's object model (which I don't). I
suggest you perform some experiments. Open the form manually and turn on the
macro recorder. Then practice pasting some information into the fields.
Then stop the recorder and examine the code that results.

Then adapt.
--
Gary''s Student - gsnu200856


"Steve" wrote:

Thanks

What if the Word document is a form and I need to place the cell info in a
particular place?




"Gary''s Student" wrote:

http://www.erlandsendata.no/english/...olecontrolword
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi

I need to write out information from cells in Excel into MS Word.

a) Can this be done
b) Can it be done without having MS Word oopen
c) Do I need to have MS Word set up a particular way

If there are some examples somewhere that would be great.

Many Thanks

Steve


Steve

Writing excel info into MS Word
 
How to I add a reference to the word library

would this account for the error: User-defined type not defined

Thanks


"Steve" wrote:

Thanks

What if the Word document is a form and I need to place the cell info in a
particular place?




"Gary''s Student" wrote:

http://www.erlandsendata.no/english/...olecontrolword
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi

I need to write out information from cells in Excel into MS Word.

a) Can this be done
b) Can it be done without having MS Word oopen
c) Do I need to have MS Word set up a particular way

If there are some examples somewhere that would be great.

Many Thanks

Steve


Steve

Writing excel info into MS Word
 
Cheers

I shall do that

I've sort the reference.

"Gary''s Student" wrote:

We are coming to the fun part!

Commanding Word means understanding Word's object model (which I don't). I
suggest you perform some experiments. Open the form manually and turn on the
macro recorder. Then practice pasting some information into the fields.
Then stop the recorder and examine the code that results.

Then adapt.
--
Gary''s Student - gsnu200856


"Steve" wrote:

Thanks

What if the Word document is a form and I need to place the cell info in a
particular place?




"Gary''s Student" wrote:

http://www.erlandsendata.no/english/...olecontrolword
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi

I need to write out information from cells in Excel into MS Word.

a) Can this be done
b) Can it be done without having MS Word oopen
c) Do I need to have MS Word set up a particular way

If there are some examples somewhere that would be great.

Many Thanks

Steve


ryguy7272

Writing excel info into MS Word
 
Take a look at this:
http://word.mvps.org/FAQs/InterDev/C...WordFromXL.htm

This too:
http://addbalance.com/usersguide/fields.htm

And this:
http://gregmaxey.mvps.org/Word_Fields.htm

Finally, once you get the DocVariable fields set up in Word (hit Alt + F9 to
see all fields), run this code from Excel.
Sub PushToWord()

Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)

With doc
..Variables("VarNumber1").Value = Range("VarNumber1").Value
..Variables("VarNumber2").Value = Range("VarNumber2").Value
'etc
..Range.Fields.Update
End With

'ActiveDocument.Fields.Update

objWord.Visible = True

End Sub

Note: This code runs in Excel; pushes Excel variables (assigned as Named
Ranges) to Word.

Regards,
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Steve" wrote:

Cheers

I shall do that

I've sort the reference.

"Gary''s Student" wrote:

We are coming to the fun part!

Commanding Word means understanding Word's object model (which I don't). I
suggest you perform some experiments. Open the form manually and turn on the
macro recorder. Then practice pasting some information into the fields.
Then stop the recorder and examine the code that results.

Then adapt.
--
Gary''s Student - gsnu200856


"Steve" wrote:

Thanks

What if the Word document is a form and I need to place the cell info in a
particular place?




"Gary''s Student" wrote:

http://www.erlandsendata.no/english/...olecontrolword
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi

I need to write out information from cells in Excel into MS Word.

a) Can this be done
b) Can it be done without having MS Word oopen
c) Do I need to have MS Word set up a particular way

If there are some examples somewhere that would be great.

Many Thanks

Steve


Steve

Writing excel info into MS Word
 
Appreciate this.

many Thanks

"ryguy7272" wrote:

Take a look at this:
http://word.mvps.org/FAQs/InterDev/C...WordFromXL.htm

This too:
http://addbalance.com/usersguide/fields.htm

And this:
http://gregmaxey.mvps.org/Word_Fields.htm

Finally, once you get the DocVariable fields set up in Word (hit Alt + F9 to
see all fields), run this code from Excel.
Sub PushToWord()

Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)

With doc
.Variables("VarNumber1").Value = Range("VarNumber1").Value
.Variables("VarNumber2").Value = Range("VarNumber2").Value
'etc
.Range.Fields.Update
End With

'ActiveDocument.Fields.Update

objWord.Visible = True

End Sub

Note: This code runs in Excel; pushes Excel variables (assigned as Named
Ranges) to Word.

Regards,
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Steve" wrote:

Cheers

I shall do that

I've sort the reference.

"Gary''s Student" wrote:

We are coming to the fun part!

Commanding Word means understanding Word's object model (which I don't). I
suggest you perform some experiments. Open the form manually and turn on the
macro recorder. Then practice pasting some information into the fields.
Then stop the recorder and examine the code that results.

Then adapt.
--
Gary''s Student - gsnu200856


"Steve" wrote:

Thanks

What if the Word document is a form and I need to place the cell info in a
particular place?




"Gary''s Student" wrote:

http://www.erlandsendata.no/english/...olecontrolword
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi

I need to write out information from cells in Excel into MS Word.

a) Can this be done
b) Can it be done without having MS Word oopen
c) Do I need to have MS Word set up a particular way

If there are some examples somewhere that would be great.

Many Thanks

Steve



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com