hello
is there a way to turn an excel workbook into a word document?.
thanks
hello
is there a way to turn an excel workbook into a word document?.
thanks
moshe
Uh... turn it into a word document, no.
But if you wanted to copy data from Excel to Word, that can be done. Are you looking to copy over tables, just specific ranges, or everything that's in your workbook?
Ken Puls, CMA - Microsoft MVP (Excel)
I hate it when my computer does what I tell it to, and not what I want it to.
Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar
This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!
Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!
hello
i want to copy a range of cells into a word documents .
it mat be a table of data.
could it be doen through vba?
thanks
moshe
Put this into an Excel module:
[vba]Sub PushSelectionToWord()
Dim wdApp As Object
Set wdApp = GetObject(, "Word.Application")
Selection.Copy
wdApp.Selection.Paste
Set wdApp = Nothing
End Sub[/vba]
Make sure that you only have one instance of Word running, and place the insertion point exactly where you want the data to come in. Save it before you run the macro, just in case you don't like what happens, though.
Go back to Excel, select the range of cells you want to send over, and run the macro.
It will create a table in Word of the cells you selected.
HTH,
Ken Puls, CMA - Microsoft MVP (Excel)
I hate it when my computer does what I tell it to, and not what I want it to.
Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar
This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!
Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!
hello
thanks for the macro.what about updating the word document if my excek sheet hase changed assumig both are open.
thanks again
moshe
Well, the easy way would be to delete the stuff that was inserted by the macro and run it again. In this case, there isn't really an easy way to identify what came from the macro, and what didn't...
Ken Puls, CMA - Microsoft MVP (Excel)
I hate it when my computer does what I tell it to, and not what I want it to.
Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar
This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!
Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!
Hi moshe,
What are you trying to achieve here?
Your original question asked about 'changing a workbook'. Ken's code copies the Selection, which may be just a part of a workbook.
If you want a Word document which reflects the latest version of a workbook, what about embedding a link to it rather than copying the contents?
Enjoy,
Tony
---------------------------------------------------------------
Give a man a fish and he'll eat for a day.
Teach him how to fish and he'll sit in a boat and drink beer all day.
I'm (slowly) building my own site: www.WordArticles.com
Makes sense to me.