Try this (forgot where I got it; I didn't create it).
Sub CopyWorksheetsToWord()
' requires a reference to the Word Object library:
' in the VBE select Tools, References and check the Microsoft Word X.X
object library
Dim wdApp As Word.Application, wdDoc As Word.Document, ws As Worksheet
Application.ScreenUpdating = False
Application.StatusBar = "Creating new document..."
Set wdApp = New Word.Application
Set wdDoc = wdApp.Documents.Add
For Each ws In ActiveWorkbook.Worksheets
Application.StatusBar = "Copying data from " & ws.Name & "..."
ws.UsedRange.Copy ' or edit to the range you want to copy
wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.InsertParagraphAfter
wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.Paste
Application.CutCopyMode = False
wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.InsertParagraphAfter
' insert page break after all worksheets except the last one
If Not ws.Name = Worksheets(Worksheets.Count).Name Then
With wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range
.InsertParagraphBefore
.Collapse Direction:=wdCollapseEnd
.InsertBreak Type:=wdPageBreak
End With
End If
Next ws
Set ws = Nothing
Application.StatusBar = "Cleaning up..."
' apply normal view
With wdApp.ActiveWindow
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdNormalView
Else
.View.Type = wdNormalView
End If
End With
Set wdDoc = Nothing
wdApp.Visible = True
Set wdApp = Nothing
Application.StatusBar = False
End Sub
--
RyGuy
"MyVeryOwnSelf" wrote:
> > How can I change an excel spreadsheet into a word doc
>
> If you know how many rows and columns you want, maybe this'll help:
>
> 1. Create a table in Word with the desired number of rows and columns.
>
> 2. In Excel, select the cells to be copied, and use
> Edit > Copy
>
> 3. Back in Word, select the actual table columns. That is, hover the cursor
> at the top of the left-most column until the down-arrow appears, then left-
> click and hold it while dragging the cursor to the right to the last column
> but not beyond it. Make sure the little rectangles to the right of the
> table border are not selected. Then use:
> Edit > Paste cells
>
> (I have Excel 2003 and Word 2003.)
>
|