LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Exporting text to a Word document

I have borrowed this code from a Microsoft CD and I am trying to alter
it so that it will select a range from my Excel workbook, say A1 to
F16, and show it as a table in Word.

At the minute, it only take the first cell and puts it in word.

Sub ExportFiguresToReport()
Dim oDocument As Word.Document
Dim sTitle As String, sResult As String

' IS IT THESE TWO LINES WHICH I NEED TO CHANGE?

sTitle = ActiveSheet.Cells(1, 1).Text
sResult = ActiveSheet.Cells(6, 2).Text
Set oDocument = CreateObject("Word.Document")
With oDocument
With .Application
If .Visible = False Then .Visible = True
.WindowState = wdWindowStateMaximize
.Activate
End With
With .Paragraphs(1).Range
.Text = sTitle & Chr(13)
.Style = "Heading 1"
.Font.Underline = wdUnderlineSingle
End With
With .Paragraphs.Add.Range
.Text = "Total: " & sResult & Chr(13)
.Style = "Heading 2"
End With
End With
End Sub
 
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
Attach Word document to a text box in Excel Ahmed Habib[_2_] Excel Discussion (Misc queries) 0 July 15th 09 08:23 PM
Attach Word document to a text box in Excel Ahmed Habib[_2_] Excel Discussion (Misc queries) 1 July 15th 09 03:13 PM
moving text from a word document to excel gregp22 New Users to Excel 2 March 21st 06 06:18 PM
The last column in my word document contains both text and number Ishta Excel Worksheet Functions 2 December 12th 05 07:00 PM
Exporting multiple cell contents into word document Davy L Excel Worksheet Functions 1 September 6th 05 04:06 AM


All times are GMT +1. The time now is 09:36 PM.

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

About Us

"It's about Microsoft Excel"